package cn.stylefeng.guns.modular.bs.equipmentInfo.controller; import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo; import cn.stylefeng.guns.modular.bs.equipmentInfo.entity.EquipmentInfo; import cn.stylefeng.guns.modular.bs.equipmentInfo.model.params.EquipmentInfoParam; import cn.stylefeng.guns.modular.bs.equipmentInfo.model.result.EquipmentInfoResult; import cn.stylefeng.guns.modular.bs.equipmentInfo.service.EquipmentInfoService; import cn.stylefeng.guns.modular.om.productionOrdeInfo.model.params.ProductionOrdeInfoParam; import cn.stylefeng.guns.modular.om.productionOrdeInfo.model.result.ProductionOrdeInfoResult; import cn.stylefeng.roses.core.base.controller.BaseController; import cn.stylefeng.roses.kernel.model.response.ResponseData; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 设备档案控制器 * * @author cl * @Date 2022-10-28 10:10:06 */ @Controller @RequestMapping("/equipmentInfo") public class EquipmentInfoController extends BaseController { private String PREFIX = "modular/bs/equipmentInfo"; @Autowired private EquipmentInfoService equipmentInfoService; /** * 跳转到主页面 * * @author cl * @Date 2022-10-28 */ @RequestMapping("") public String index() { return PREFIX + "/equipmentInfo.html"; } /** * 新增页面 * * @author cl * @Date 2022-10-28 */ @RequestMapping("/add") public String add() { return PREFIX + "/equipmentInfo_add.html"; } /** * 编辑页面 * * @author cl * @Date 2022-10-28 */ @RequestMapping("/edit") public String edit() { return PREFIX + "/equipmentInfo_edit.html"; } /** * 新增接口 * * @author cl * @Date 2022-10-28 */ @RequestMapping("/addItem") @ResponseBody public ResponseData addItem(EquipmentInfoParam equipmentInfoParam) { this.equipmentInfoService.add(equipmentInfoParam); return ResponseData.success(); } /** * 编辑接口 * * @author cl * @Date 2022-10-28 */ @RequestMapping("/editItem") @ResponseBody public ResponseData editItem(EquipmentInfoParam equipmentInfoParam) { this.equipmentInfoService.update(equipmentInfoParam); return ResponseData.success(); } /** * 导出excel * * @author cl * @Date 2022-10-28 */ @RequestMapping("/exportTable") @ResponseBody public ResponseData exportTable(EquipmentInfoParam equipmentInfoParam) { List list = equipmentInfoService.exportTable(equipmentInfoParam); return ResponseData.success(list); } /** * 删除接口 * * @author cl * @Date 2022-10-28 */ @RequestMapping("/delete") @ResponseBody public ResponseData delete(EquipmentInfoParam equipmentInfoParam) { this.equipmentInfoService.delete(equipmentInfoParam); return ResponseData.success(); } /** * 查看详情接口 * * @author cl * @Date 2022-10-28 */ @RequestMapping("/detail") @ResponseBody public ResponseData detail(EquipmentInfoParam equipmentInfoParam) { EquipmentInfo detail = this.equipmentInfoService.getById(equipmentInfoParam.getId()); return ResponseData.success(detail); } /** * 查询列表 * * @author cl * @Date 2022-10-28 */ @ResponseBody @RequestMapping("/list") public LayuiPageInfo list(EquipmentInfoParam equipmentInfoParam) { return this.equipmentInfoService.findPageBySpec(equipmentInfoParam); } @ResponseBody @CrossOrigin @RequestMapping("/largeScreenList") public List largeScreenList(EquipmentInfoParam equipmentInfoParam) { ArrayList arrayList = new ArrayList(); LayuiPageInfo pageBySpec = this.equipmentInfoService.findPageBySpec(equipmentInfoParam); List result = pageBySpec.getData(); for (EquipmentInfoResult equipmentInfoResult : result) { ArrayList resultList = new ArrayList(); resultList.add(equipmentInfoResult.getWorkshopCode()); resultList.add(equipmentInfoResult.getEquipmentNo()); resultList.add(equipmentInfoResult.getLocationCode()); arrayList.add(resultList); } return arrayList; } @ResponseBody @CrossOrigin @RequestMapping("/DeviceInformation") public Map DeviceInformation() { HashMap map = new HashMap(); map.put("onLineQuantity","45"); map.put("equipmentQuantity","36"); map.put("waitQuantity","89"); map.put("hitchQuantity","12"); return map; } @ResponseBody @CrossOrigin @RequestMapping("/centerLeft1") public ResponseData centerLeft1() { Map map = new HashMap(); List xData = new ArrayList(); List seriesData = new ArrayList(); List list = equipmentInfoService.centerLeft1(); for (EquipmentInfoResult equipmentInfoResult : list) { Map map1 = new HashMap(); xData.add(equipmentInfoResult.getEquipmentNo()); map1.put("name",equipmentInfoResult.getEquipmentNo()); map1.put("value",Integer.valueOf( equipmentInfoResult.getNum())); seriesData.add(map1); } map.put("xData",xData); map.put("seriesData",seriesData); return ResponseData.success(map); } }