diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/controller/DevChangeController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/controller/DevChangeController.java index 5f8413c..4d86329 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/controller/DevChangeController.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/controller/DevChangeController.java @@ -2,9 +2,14 @@ package com.bonus.material.devchange.controller; import cn.hutool.core.convert.Convert; import com.bonus.common.biz.config.ListPagingUtil; +import com.bonus.common.core.utils.poi.ExcelUtil; import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.core.web.page.TableDataInfo; +import com.bonus.common.log.annotation.SysLog; +import com.bonus.common.log.enums.OperaType; +import com.bonus.material.basic.domain.BmSlideShow; +import com.bonus.material.common.annotation.PreventRepeatSubmit; import com.bonus.material.devchange.domain.CsDeviceChangeDetailsVo; import com.bonus.material.devchange.domain.CsDeviceChangeVo; import com.bonus.material.devchange.domain.DevChangeVo; @@ -17,6 +22,7 @@ import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; import java.util.List; @RestController @@ -67,7 +73,7 @@ public class DevChangeController extends BaseController { - @ApiOperation(value = "新增出库、入库、-退役、维修 ") + @ApiOperation(value = "新增出库") @PostMapping("/addChangeInfo") public AjaxResult addChangeInfo(@RequestBody CsDeviceChangeVo vo) { return service.addChangeInfo(vo); @@ -75,6 +81,32 @@ public class DevChangeController extends BaseController { + @ApiOperation(value = "入库和维修") + @PostMapping("/updateDevChangeInfo") + public AjaxResult updateDevChangeInfo(@RequestBody CsDeviceChangeVo vo) { + return service.updateDevChangeInfo(vo); + } + + @ApiOperation(value = "入库、报废") + @PostMapping("/updateDevChangeInfo2") + public AjaxResult updateDevChangeInfo2(@RequestBody CsDeviceChangeVo vo) { + return service.updateDevChangeInfo2(vo); + } + + @ApiOperation(value = "入库、报废") + @PostMapping("/updateDevChangeInfo3") + public AjaxResult updateDevChangeInfo3(@RequestBody CsDeviceChangeVo vo) { + return service.updateDevChangeInfo3(vo); + } + + + @ApiOperation(value = "导出设备流转台账") + @PostMapping("/export") + public void export(HttpServletResponse response, CsDeviceChangeVo vo) { + List list = service.getDevChangeList(vo); + ExcelUtil util = new ExcelUtil(CsDeviceChangeVo.class); + util.exportExcel(response, list, "设备流转台账"); + } @@ -86,10 +118,19 @@ public class DevChangeController extends BaseController { return getDataTable(list); } + @ApiOperation(value = "导出设备流转台账详情") + @PostMapping("/exportDetails") + public void exportDetails(HttpServletResponse response, CsDeviceChangeDetailsVo vo) { + List list = service.getDevDetails(vo); + ExcelUtil util = new ExcelUtil(DevChangeVo.class); + util.exportExcel(response, list, "导出设备流转台账详情"); + } + + @ApiOperation(value = "出库记录单") @PostMapping("/getDevDetails") public AjaxResult getDevDetails(@RequestBody CsDeviceChangeDetailsVo vo) { - return service.getDevDetails(vo); + return AjaxResult.success(service.getDevDetails(vo)); } } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/CsDeviceChangeDetailsVo.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/CsDeviceChangeDetailsVo.java index 6ab0483..ffdbf0a 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/CsDeviceChangeDetailsVo.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/CsDeviceChangeDetailsVo.java @@ -8,6 +8,13 @@ public class CsDeviceChangeDetailsVo { private Integer pageNum; private Integer pageSize; + + private String proId; + + private int num=1; + + private String type; + /** * 主键 */ diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/CsDeviceChangeVo.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/CsDeviceChangeVo.java index 05e7bc0..305498b 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/CsDeviceChangeVo.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/CsDeviceChangeVo.java @@ -1,5 +1,6 @@ package com.bonus.material.devchange.domain; +import com.bonus.common.core.annotation.Excel; import lombok.Data; @Data @@ -12,6 +13,14 @@ public class CsDeviceChangeVo { private Integer pageNum; private Integer pageSize; + /** + * 退役原因 + */ + private String reasonId; + /** + * 退役原因 + */ + private String reasonVal; /** * 主键 */ @@ -19,11 +28,18 @@ public class CsDeviceChangeVo { /** * 变更状前状态 */ + @Excel(name = "流转前状态",width = 20,sort = 4) + private String changeStatusName; + private String changeStatus; /** * 类型 * 变更类型 1入库 2出库 3 退役 4 维修 */ + @Excel(name = "操作类型",width = 25 ,sort = 2) + private String typeName; + + private String type; /** * 变更状态 0自用 1共享 @@ -36,6 +52,7 @@ public class CsDeviceChangeVo { /** * 工程名称 */ + @Excel(name = "使用项目",width = 25,sort = 7) private String proName; /** * 工程类型 @@ -44,6 +61,7 @@ public class CsDeviceChangeVo { /** * 设备数量 */ + @Excel(name = "设备数量",width = 25,sort = 9) private String devNum; /** * 电压等级 @@ -52,6 +70,7 @@ public class CsDeviceChangeVo { /** * 使用单位 */ + @Excel(name = "使用单位",width = 25,sort = 6) private String useUint; /** * 省 @@ -68,14 +87,17 @@ public class CsDeviceChangeVo { /** * 详细地址 */ + @Excel(name = "使用地址",width = 25,sort = 8) private String proLocation; /** * 创建时间 */ + @Excel(name = "操作时间",width = 25,sort = 2) private String createTime; /** * 创建人 */ + @Excel(name = "操作人",width = 20,sort = 1) private String createUser; /** * 使用人 diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/DevChangeDetailsVo.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/DevChangeDetailsVo.java new file mode 100644 index 0000000..63de104 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/DevChangeDetailsVo.java @@ -0,0 +1,28 @@ +package com.bonus.material.devchange.domain; + +import lombok.Data; + +@Data +public class DevChangeDetailsVo { + + private String id; + + private int num=1; + + private String type; + + private String proId; + + private String devId; + + public DevChangeDetailsVo() { + } + + public DevChangeDetailsVo(String devId, String proId, String type, int num) { + this.num = num; + this.type = type; + this.proId = proId; + this.devId = devId; + } + +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/DevChangeVo.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/DevChangeVo.java index 94f9833..0d1a717 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/DevChangeVo.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/DevChangeVo.java @@ -1,5 +1,6 @@ package com.bonus.material.devchange.domain; +import com.bonus.common.core.annotation.Excel; import com.bonus.material.device.domain.vo.DevInfoPropertyVo; import lombok.Data; @@ -42,10 +43,12 @@ public class DevChangeVo { /** * 设备型号 */ + @Excel(name = "设备型号",width = 25 ,sort = 2) private String devModel; /** * 设备名称 */ + @Excel(name = "设备名称",width = 25 ,sort = 1) private String devName; /** * 等级 @@ -66,6 +69,7 @@ public class DevChangeVo { /** * 设备编码 */ + @Excel(name = "设备名称",width = 25 ,sort = 3) private String devCode; /** * 产权单位 diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/mapper/DevChangeMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/mapper/DevChangeMapper.java index dfdbf3e..9cc1770 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/mapper/DevChangeMapper.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/mapper/DevChangeMapper.java @@ -1,10 +1,7 @@ package com.bonus.material.devchange.mapper; import com.bonus.common.core.web.domain.AjaxResult; -import com.bonus.material.devchange.domain.CsDeviceChangeDetailsVo; -import com.bonus.material.devchange.domain.CsDeviceChangeVo; -import com.bonus.material.devchange.domain.DevChangeVo; -import com.bonus.material.devchange.domain.JjProjectVo; +import com.bonus.material.devchange.domain.*; import com.bonus.material.device.domain.vo.DevInfoPropertyVo; import com.bonus.material.device.domain.vo.DevInfoVo; import org.apache.ibatis.annotations.Mapper; @@ -96,7 +93,7 @@ public interface DevChangeMapper { * @param vo * @return */ - List getDevDetails(CsDeviceChangeDetailsVo vo); + List getDevDetails(CsDeviceChangeDetailsVo vo); /** * 电压等级 @@ -104,4 +101,29 @@ public interface DevChangeMapper { * @return */ List getVoltageLevel(JjProjectVo vo); + + /** + * 修改详情 + * @param deviceChangeDetailsVo + */ + void addDevChangeDetails(DevChangeDetailsVo deviceChangeDetailsVo); + + /** + * 查询数据 + * @param vo + * @return + */ + List getDevChangeDetailsList(DevChangeDetailsVo vo); + + /** + * + * @param voo + */ + void deleteDevChangeDetails(DevChangeDetailsVo voo); + + /** + * 修改数量 + * @param newNum + */ + void updateChangeDetailsNum(DevChangeDetailsVo voo); } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/service/DevChangeService.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/service/DevChangeService.java index 07d699b..79906be 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/service/DevChangeService.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/service/DevChangeService.java @@ -49,7 +49,7 @@ public interface DevChangeService { * @param vo * @return */ - AjaxResult getDevDetails(CsDeviceChangeDetailsVo vo); + List getDevDetails(CsDeviceChangeDetailsVo vo); /** * 电压等级下拉选 @@ -57,4 +57,10 @@ public interface DevChangeService { * @return */ List getVoltageLevel(JjProjectVo vo); + + AjaxResult updateDevChangeInfo(CsDeviceChangeVo vo); + + AjaxResult updateDevChangeInfo2(CsDeviceChangeVo vo); + + AjaxResult updateDevChangeInfo3(CsDeviceChangeVo vo); } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/service/DevChangeServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/service/DevChangeServiceImpl.java index 971b46b..a1f38ac 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/service/DevChangeServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/service/DevChangeServiceImpl.java @@ -5,10 +5,7 @@ import com.alibaba.fastjson.JSON; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.security.utils.SecurityUtils; import com.bonus.material.common.utils.StringUtil; -import com.bonus.material.devchange.domain.CsDeviceChangeDetailsVo; -import com.bonus.material.devchange.domain.CsDeviceChangeVo; -import com.bonus.material.devchange.domain.DevChangeVo; -import com.bonus.material.devchange.domain.JjProjectVo; +import com.bonus.material.devchange.domain.*; import com.bonus.material.devchange.mapper.DevChangeMapper; import com.bonus.material.device.domain.vo.DevInfoPropertyVo; import com.bonus.material.device.domain.vo.DevInfoVo; @@ -66,6 +63,191 @@ public class DevChangeServiceImpl implements DevChangeService { return new ArrayList<>(); } + /** + * 维修 + * @param vo + * @return + */ + @Override + public AjaxResult updateDevChangeInfo(CsDeviceChangeVo vo) { + try{ + String username = SecurityUtils.getLoginUser().getUsername(); + vo.setCreateUser(username); + String proCode=vo.getProCode(); + if (StringUtils.isBlank(proCode)) { + return AjaxResult.error("请选择工程"); + } + if (StringUtils.isBlank(vo.getType())) { + return AjaxResult.error("请上传类型type:1入库 2出库 3 退役 4 维修"); + } + String json=vo.getJsonData(); + if (StringUtils.isBlank(json)) { + return AjaxResult.error("请选择变更的设备"); + } + List list=JSON.parseArray(json, CsDeviceChangeDetailsVo.class); + if(list==null || list.isEmpty()){ + return AjaxResult.error("请选择变更的设备"); + } + + //出库 + if("2".equals(vo.getType())){ + String changeUnit=mapper.getChangeUnit(list.get(0).getDevId()); + vo.setChangeUnit(changeUnit); + } else { + // + String changeUnit=mapper.getChangeUnitById(list.get(0).getDevId()); + vo.setChangeUnit(changeUnit); + } + if("1".equals(vo.getType())){ + //入库厂家 + String changeUnit=mapper.getChangeUnit(list.get(0).getDevId()); + vo.setUseUint(changeUnit); + } + //变更前状态查询 + String changeStatus=mapper.getChangeStatus(list.get(0).getDevId()); + vo.setChangeStatus(changeStatus); + vo.setDevNum(list.size()+""); + int num=mapper.addChangeInfo(vo); + if(num>0){ + for (CsDeviceChangeDetailsVo deviceChangeDetailsVo:list){ + if("1".equals(vo.getStatus())){ + updateDevDetails(deviceChangeDetailsVo.getDevId(),null,"1",deviceChangeDetailsVo.getNum()); + + }else{ + updateDevDetails(deviceChangeDetailsVo.getDevId(),null,"5",deviceChangeDetailsVo.getNum()); + } + //新增设备列表数据 + deviceChangeDetailsVo.setChangeId(vo.getId()); + //新增设备详情 + int isSuccess= mapper.addDetailsInfo(deviceChangeDetailsVo); + if(isSuccess>0){ + vo.setDevId(deviceChangeDetailsVo.getDevId()); + vo.setChangeStatus(vo.getStatus()); + vo.setUseUint(null); + vo.setUserName(null); + vo.setUserPhone(null); + vo.setProCode(null); + mapper.updateDevInfo(vo); + } + } + } + }catch (Exception e){ + log.error(e.getMessage()); + } + return AjaxResult.success(); + } + + /** + * 报废接口 + * @param vo + * @return + */ + @Override + public AjaxResult updateDevChangeInfo3(CsDeviceChangeVo vo) { + try{ + String username = SecurityUtils.getLoginUser().getUsername(); + vo.setCreateUser(username); + if (StringUtils.isBlank(vo.getType())) { + return AjaxResult.error("请上传类型type:1入库 2出库 3 退役 4 维修"); + } + String json=vo.getJsonData(); + if (StringUtils.isBlank(json)) { + return AjaxResult.error("请选择变更的设备"); + } + List list=JSON.parseArray(json, CsDeviceChangeDetailsVo.class); + if(list==null || list.isEmpty()){ + return AjaxResult.error("请选择变更的设备"); + } + //入库厂家 + String usUnit=mapper.getChangeUnit(list.get(0).getDevId()); + vo.setUseUint(usUnit); + vo.setChangeUnit(usUnit); + vo.setChangeStatus("1"); + vo.setDevNum(list.size()+""); + String proId=vo.getProCode(); + int num=mapper.addChangeInfo(vo); + if(num>0){ + for (CsDeviceChangeDetailsVo deviceChangeDetailsVo:list){ + updateDevDetails(deviceChangeDetailsVo.getDevId(),proId,"4",deviceChangeDetailsVo.getNum()); + //新增设备列表数据 + deviceChangeDetailsVo.setChangeId(vo.getId()); + deviceChangeDetailsVo.setReasonVal(vo.getReasonVal()); + deviceChangeDetailsVo.setReasonId(vo.getReasonId()); + //新增设备详情 + int isSuccess= mapper.addDetailsInfo(deviceChangeDetailsVo); + if(isSuccess>0){ + vo.setDevId(deviceChangeDetailsVo.getDevId()); + vo.setChangeStatus(vo.getStatus()); + vo.setUseUint(null); + vo.setUserName(null); + vo.setUserPhone(null); + vo.setProCode(null); + mapper.updateDevInfo(vo); + } + } + } + }catch (Exception e){ + log.error(e.getMessage()); + } + return AjaxResult.success(); + } + /** + * 维修接口 + * @param vo + * @return + */ + @Override + public AjaxResult updateDevChangeInfo2(CsDeviceChangeVo vo) { + try{ + String username = SecurityUtils.getLoginUser().getUsername(); + vo.setCreateUser(username); + if (StringUtils.isBlank(vo.getType())) { + return AjaxResult.error("请上传类型type:1入库 2出库 3 退役 4 维修"); + } + String json=vo.getJsonData(); + if (StringUtils.isBlank(json)) { + return AjaxResult.error("请选择变更的设备"); + } + List list=JSON.parseArray(json, CsDeviceChangeDetailsVo.class); + if(list==null || list.isEmpty()){ + return AjaxResult.error("请选择变更的设备"); + } + //入库厂家 + String usUnit=mapper.getChangeUnit(list.get(0).getDevId()); + vo.setUseUint(usUnit); + vo.setChangeUnit(usUnit); + vo.setChangeStatus("5"); + vo.setDevNum(list.size()+""); + String proId=vo.getProCode(); + int num=mapper.addChangeInfo(vo); + if(num>0){ + for (CsDeviceChangeDetailsVo deviceChangeDetailsVo:list){ + if("1".equals(vo.getStatus())){ + updateDevDetails2(deviceChangeDetailsVo.getDevId(),proId,"1",deviceChangeDetailsVo.getNum()); + }else{ + updateDevDetails2(deviceChangeDetailsVo.getDevId(),proId,"4",deviceChangeDetailsVo.getNum()); + } + //新增设备列表数据 + deviceChangeDetailsVo.setChangeId(vo.getId()); + //新增设备详情 + int isSuccess= mapper.addDetailsInfo(deviceChangeDetailsVo); + if(isSuccess>0){ + vo.setDevId(deviceChangeDetailsVo.getDevId()); + vo.setChangeStatus(vo.getStatus()); + vo.setUseUint(null); + vo.setUserName(null); + vo.setUserPhone(null); + vo.setProCode(null); + mapper.updateDevInfo(vo); + } + } + } + }catch (Exception e){ + log.error(e.getMessage()); + } + return AjaxResult.success(); + } + /** * 新增设备台账数据 * @param vo @@ -114,6 +296,8 @@ public class DevChangeServiceImpl implements DevChangeService { for (CsDeviceChangeDetailsVo deviceChangeDetailsVo:list){ //新增设备列表数据 deviceChangeDetailsVo.setChangeId(vo.getId()); + //数据更新 + updateDevDetails(deviceChangeDetailsVo.getDevId(),vo.getProCode(),vo.getType(),deviceChangeDetailsVo.getNum()); //新增设备详情 int isSuccess= mapper.addDetailsInfo(deviceChangeDetailsVo); if(isSuccess>0){ @@ -138,6 +322,85 @@ public class DevChangeServiceImpl implements DevChangeService { } return AjaxResult.success(); } + public void updateDevDetails2(String devId,String proCode,String type,int num){ + try{ + DevChangeDetailsVo vo=new DevChangeDetailsVo(devId,proCode,type,num); + List list=mapper.getDevChangeDetailsList(vo); + DevChangeDetailsVo devChangeDetailsVo=new DevChangeDetailsVo(devId,proCode,"5",num); + List newList=mapper.getDevChangeDetailsList(devChangeDetailsVo); + for (DevChangeDetailsVo voo:newList){ + if(voo.getNum()==num){ + mapper.deleteDevChangeDetails(voo); + }else if(voo.getNum()>num){ + int newNum=voo.getNum()-num; + vo.setNum(newNum); + mapper.updateChangeDetailsNum(vo); + } + } + //入库--报废 + if("4".equals(type) ){ + if(list==null || list.isEmpty()){ + mapper.addDevChangeDetails(vo); + }else{ + for (DevChangeDetailsVo voo:list){ + int newNum=voo.getNum()+num; + vo.setNum(newNum); + mapper.updateChangeDetailsNum(vo); + } + } + } + }catch (Exception e){ + log.error(e.getMessage()); + } + } + /** + * 修改设备 状态 + */ + public void updateDevDetails(String devId,String proCode,String type,int num){ + try{ + DevChangeDetailsVo vo=new DevChangeDetailsVo(devId,proCode,type,num); + List list=mapper.getDevChangeDetailsList(vo); + if( "1".equals(type) || "5".equals(type)){ + DevChangeDetailsVo devChangeDetailsVo=new DevChangeDetailsVo(devId,proCode,"2",num); + List newList=mapper.getDevChangeDetailsList(devChangeDetailsVo); + for (DevChangeDetailsVo voo:newList){ + if(voo.getNum()==num){ + mapper.deleteDevChangeDetails(voo); + }else if(voo.getNum()>num){ + int newNum=voo.getNum()-num; + vo.setNum(newNum); + mapper.updateChangeDetailsNum(vo); + } + } + } + //入库 + if("1".equals(type)){ + //查询 历史数据 进行删除 + for (DevChangeDetailsVo voo:list){ + if(voo.getNum()==num){ + mapper.deleteDevChangeDetails(voo); + }else if(voo.getNum()>num){ + int newNum=voo.getNum()-num; + vo.setNum(newNum); + mapper.updateChangeDetailsNum(vo); + } + } + } else if("2".equals(type) || "3".equals(type) || "4".equals(type) || "5".equals(type)){ + if(list==null || list.isEmpty()){ + mapper.addDevChangeDetails(vo); + }else{ + for (DevChangeDetailsVo voo:list){ + int newNum=voo.getNum()+num; + vo.setNum(newNum); + mapper.updateChangeDetailsNum(vo); + } + } + } + }catch (Exception e){ + log.error(e.getMessage()); + } + + } /** * 查询工程下拉选 @@ -175,14 +438,14 @@ public class DevChangeServiceImpl implements DevChangeService { * @return */ @Override - public AjaxResult getDevDetails(CsDeviceChangeDetailsVo vo) { + public List getDevDetails(CsDeviceChangeDetailsVo vo) { try{ - List list=mapper.getDevDetails(vo); - return AjaxResult.success(list); + List list=mapper.getDevDetails(vo); + return list; }catch (Exception e){ log.error(e.getMessage()); } - return AjaxResult.success(new ArrayList<>()); + return new ArrayList<>(); } @Override diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/DevInfo.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/DevInfo.java index 60bf9df..cde8acc 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/DevInfo.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/DevInfo.java @@ -68,6 +68,9 @@ public class DevInfo extends BaseEntity { @ApiModelProperty(value = "整机装备重量") private String deviceWeight; + @ApiModelProperty(value = "设备管理方式: 0编码 1数量") + private Byte deviceType; + @Excel(name = "设备数量") @ApiModelProperty(value = "设备数量") private Integer deviceCount; diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java index 75e1f97..d8be7f5 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java @@ -10,10 +10,12 @@ import com.bonus.material.device.domain.dto.InfoMotionDto; import com.bonus.material.device.domain.vo.DevInfoPropertyVo; import com.bonus.material.device.domain.vo.DevInfoVo; import com.bonus.material.device.domain.vo.LeaseVo; +import com.bonus.material.largeScreen.entity.DevInfoReq; import com.bonus.material.largeScreen.entity.LeaseInfo; import com.bonus.material.largeScreen.entity.RentInfo; import org.apache.ibatis.annotations.Param; +import java.math.BigDecimal; import java.util.Date; import java.util.List; @@ -276,5 +278,25 @@ public interface DevInfoMapper { List getDemandUnit(DevInfoVo devInfoVo); int updateTypeLeasePrice(DevInfo devInfo); + + Integer getTotalEquipment(DevInfoReq devInfoReq); + + BigDecimal getTotalValue(DevInfoReq devInfoReq); + + int getLineNum(DevInfoReq devInfoReq); + + BigDecimal getLinePrice(DevInfoReq devInfoReq); + + List getLineProductionDateList(DevInfoReq devInfoReq); + + List getUnitEquipmentConfiguration(); + + BigDecimal getPrice(Long deptId); + + int getEquipmentStatus(String changeStatus); + + int getChangeNum(); + + int getTurnoverRate(); } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/controller/ProvinceScreenController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/controller/ProvinceScreenController.java new file mode 100644 index 0000000..a741c96 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/controller/ProvinceScreenController.java @@ -0,0 +1,161 @@ +package com.bonus.material.largeScreen.controller; + +import com.bonus.common.core.web.controller.BaseController; +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.device.domain.DevInfo; +import com.bonus.material.largeScreen.service.ProvinceScreenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author 马三炮 + * @date 2025/9/14 + */ +@Api(value = "网省大屏", tags = {"网省大屏"}) +@RestController +@RequestMapping("/provinceScreen") +public class ProvinceScreenController extends BaseController { + + @Resource + private ProvinceScreenService provinceScreenService; + + /** + * 装备总量,总价值 + * @return + */ + @ApiOperation("装备总量,总价值") + @GetMapping("/getTotalEquipment") + public AjaxResult getTotalEquipment() { + try { + Map res = provinceScreenService.getTotalEquipment(); + return AjaxResult.success(res); + } catch (Exception e) { + return AjaxResult.error("装备总量,总价值异常"); + } + } + + /** + *线路装备,变电装备,电缆装备 + * @return + */ + @ApiOperation("线路装备,变电装备,电缆装备") + @GetMapping("/getEquipmentClassification") + public AjaxResult getEquipmentClassification() { + try { + Map res = provinceScreenService.getEquipmentClassification(); + return AjaxResult.success(res); + } catch (Exception e) { + return AjaxResult.error("线路装备,变电装备,电缆装备异常"); + } + } + + /** + * 单位装备配置 + * @return + */ + @ApiOperation("单位装备配置") + @GetMapping("/getUnitEquipmentConfiguration") + public AjaxResult getUnitEquipmentConfiguration() { + try { + List> res = provinceScreenService.getUnitEquipmentConfiguration(); + return AjaxResult.success(res); + } catch (Exception e) { + return AjaxResult.error("单位装备配置异常"); + } + } + + /** + * 装备状态 + * @return + */ + @ApiOperation("装备状态") + @GetMapping("/getEquipmentStatus") + public AjaxResult getEquipmentStatus() { + try { + List> res = provinceScreenService.getEquipmentStatus(); + return AjaxResult.success(res); + } catch (Exception e) { + return AjaxResult.error("装备状态异常"); + } + } + + /** + * 项目装备 + * @return + */ + @ApiOperation("项目装备") + @GetMapping("/getProjectEquipment") + public AjaxResult getProjectEquipment() { + try { + Map res = provinceScreenService.getProjectEquipment(); + return AjaxResult.success(res); + } catch (Exception e) { + return AjaxResult.error("项目装备异常"); + } + } + + /** + * 各单位装备在用率情况 + * @return + */ + @ApiOperation("各单位装备在用率情况") + @GetMapping("/getDeptEquipment") + public AjaxResult getDeptEquipment() { + try { + List> res = provinceScreenService.getDeptEquipment(); + return AjaxResult.success(res); + } catch (Exception e) { + return AjaxResult.error("项目装备异常"); + } + } + + /** + * 工程在用装备情况 + * @return + */ + @ApiOperation("工程在用装备情况") + @GetMapping("/getEquipmentUse") + public AjaxResult getEquipmentUse() { + try { + List> res = provinceScreenService.getEquipmentUse(); + for (int i = 0; i < 10; i++) { + Map map = new HashMap<>(); + map.put("projectName","石桥-大陇π入万济变、大陇-阳湖T接万济变 35kV架空线路工程"); + map.put("inUser","82"); + map.put("scale","172"); + map.put("usage","47.67"); + res.add(map); + } + return AjaxResult.success(res); + } catch (Exception e) { + return AjaxResult.error("工程在用装备情况异常"); + } + } + + @ApiOperation("装备在用率统计") + @GetMapping("/getUsageStatistics") + public AjaxResult getUsageStatistics() { + try { + List> res = provinceScreenService.getUsageStatistics(); + for (int i = 0; i < 10; i++) { + Map map = new HashMap<>(); + map.put("projectName","石桥-大陇π入万济变、大陇-阳湖T接万济变 35kV架空线路工程"); + map.put("inUser","82"); + map.put("scale","172"); + map.put("usage","47.67"); + res.add(map); + } + return AjaxResult.success(res); + } catch (Exception e) { + return AjaxResult.error("装备在用率统计异常"); + } + } +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/entity/DevInfoReq.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/entity/DevInfoReq.java new file mode 100644 index 0000000..cc96ea4 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/entity/DevInfoReq.java @@ -0,0 +1,26 @@ +package com.bonus.material.largeScreen.entity; + +import lombok.Data; + +/** + * @author 马三炮 + * @date 2025/9/14 + */ +@Data +public class DevInfoReq { + + /** + * 设备所属公司 + */ + public Integer ownCo; + + /** + * 类型id + */ + public Integer typeId; + + /** + *默认 1 变更状态 变更类型 1入库 2、3 出库(2是自用 3共享) 4退役 5维修 + */ + public String changeStatus; +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/service/ProvinceScreenService.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/service/ProvinceScreenService.java new file mode 100644 index 0000000..2c5d555 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/service/ProvinceScreenService.java @@ -0,0 +1,51 @@ +package com.bonus.material.largeScreen.service; + +import java.util.List; +import java.util.Map; + +public interface ProvinceScreenService { + + /** + * 装备总量,总价值 + * @return + */ + Map getTotalEquipment(); + + /** + *线路装备,变电装备,电缆装备 + * @return + */ + Map getEquipmentClassification(); + + /** + * 单位装备配置 + * @return + */ + List> getUnitEquipmentConfiguration(); + + /** + * 装备状态 + * @return + */ + List> getEquipmentStatus(); + + /** + * 项目装备 + * @return + */ + Map getProjectEquipment(); + + /** + * 各单位装备在用率情况 + * @return + */ + List> getDeptEquipment(); + + /** + * 工程在用装备情况 + * @return + */ + List> getEquipmentUse(); + + List> getUsageStatistics(); +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/service/impl/ProvinceScreenServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/service/impl/ProvinceScreenServiceImpl.java new file mode 100644 index 0000000..623db9f --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/service/impl/ProvinceScreenServiceImpl.java @@ -0,0 +1,342 @@ +package com.bonus.material.largeScreen.service.impl; + +import com.bonus.common.core.utils.DateUtils; +import com.bonus.material.device.domain.DevInfo; +import com.bonus.material.device.mapper.DevInfoMapper; +import com.bonus.material.equipment.domain.DeptConfigRateSummary; +import com.bonus.material.equipment.mapper.SysDeptMapper; +import com.bonus.material.equipment.service.ISysDeptService; +import com.bonus.material.equipment.service.impl.SysDeptServiceImpl; +import com.bonus.material.largeScreen.entity.DevInfoReq; +import com.bonus.material.largeScreen.service.ProvinceScreenService; +import com.bonus.system.api.domain.SysDept; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.Period; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; +import java.util.*; + +/** + * @author 马三炮 + * @date 2025/9/14 + */ +@Service +@Slf4j +public class ProvinceScreenServiceImpl implements ProvinceScreenService { + + @Resource + private DevInfoMapper devInfoMapper; + + @Resource + private SysDeptMapper sysDeptMapper; + + @Resource + private ISysDeptService sysDeptService; + + /** + * 装备总量,总价值 + * @return + */ + @Override + public Map getTotalEquipment() { + Map res = new HashMap<>(); + DevInfoReq devInfoReq = new DevInfoReq(); + //装备总量 + Integer totalEquipmentQuantity = devInfoMapper.getTotalEquipment(devInfoReq); + res.put("totalEquipmentQuantity",totalEquipmentQuantity); + //总价值 + BigDecimal totalValue = devInfoMapper.getTotalValue(devInfoReq); + res.put("totalValue",totalValue); + return res; + } + + /** + *线路装备,变电装备,电缆装备 + * @return + */ + @Override + public Map getEquipmentClassification() { + Map res = new HashMap<>(); + Map res1 = new HashMap<>(); + Map res2 = new HashMap<>(); + Map res3 = new HashMap<>(); + DevInfoReq devInfoReq = new DevInfoReq(); + //线路装备 + //装备数 + devInfoReq.setTypeId(1); + int lineNum = devInfoMapper.getLineNum(devInfoReq); + res1.put("num",lineNum); + BigDecimal linePrice = devInfoMapper.getLinePrice(devInfoReq); + res1.put("price",linePrice); + List lineProductionDateList = devInfoMapper.getLineProductionDateList(devInfoReq); + count(res1,lineProductionDateList); + //变电装备 + //装备数 + devInfoReq.setTypeId(2); + int substationNum = devInfoMapper.getLineNum(devInfoReq); + res2.put("num",substationNum); + BigDecimal substationPrice = devInfoMapper.getLinePrice(devInfoReq); + res2.put("price",substationPrice); + List substationProductionDateList = devInfoMapper.getLineProductionDateList(devInfoReq); + count(res2,substationProductionDateList); + //电缆装备 + //装备数 + devInfoReq.setTypeId(3); + int cableNum = devInfoMapper.getLineNum(devInfoReq); + res3.put("num",cableNum); + BigDecimal cablePrice = devInfoMapper.getLinePrice(devInfoReq); + res3.put("price",cablePrice); + List cableProductionDateList = devInfoMapper.getLineProductionDateList(devInfoReq); + count(res3,cableProductionDateList); + + res.put("line",res1); + res.put("substation",res2); + res.put("cable",res3); + return res; + } + + /** + * 单位装备配置 + * @return + */ + @Override + public List> getUnitEquipmentConfiguration() { + //获取所有单位 TODO 后期可能单位放到字典表这里要修改 + SysDept sysDept = new SysDept(); + DevInfoReq devInfoReq = new DevInfoReq(); + List sysDeptList = sysDeptMapper.selectDeptList(sysDept); + List> res = new ArrayList<>(); + for (SysDept sysDeptNew:sysDeptList) { + Map dept = new HashMap<>(); + dept.put("deptName",sysDeptNew.getDeptName()); + devInfoReq.setOwnCo(Math.toIntExact(sysDeptNew.getDeptId())); + //装备价值 + BigDecimal totalValue = devInfoMapper.getTotalValue(devInfoReq); + dept.put("totalValue",totalValue); + //装备总数 + Integer totalEquipmentQuantity = devInfoMapper.getTotalEquipment(devInfoReq); + dept.put("totalEquipmentQuantity",totalEquipmentQuantity); + //线路 + devInfoReq.setTypeId(1); + int lineNum = devInfoMapper.getLineNum(devInfoReq); + dept.put("lineNum",lineNum); + //变电 + devInfoReq.setTypeId(2); + int substationNum = devInfoMapper.getLineNum(devInfoReq); + dept.put("substationNum",substationNum); + //电缆 + devInfoReq.setTypeId(3); + int cableNum = devInfoMapper.getLineNum(devInfoReq); + dept.put("cableNum",cableNum); + // 获取装备转换率 + DeptConfigRateSummary user = new DeptConfigRateSummary(); + List list = sysDeptService.selectDeptConfigRatePivot(user); + for (DeptConfigRateSummary deptConfigRateSummary: list) { + if (deptConfigRateSummary.getDeptId().equals(sysDeptNew.getDeptId())){ + //总数 + dept.put("configRate",deptConfigRateSummary.getConfigRate()); + //线路 + dept.put("valueA",deptConfigRateSummary.getValueA()); + //变电 + dept.put("valueA",deptConfigRateSummary.getValueB()); + //电缆 + dept.put("valueA",deptConfigRateSummary.getValueC()); + } + } + res.add(dept); + } + return res; + } + + /** + * 装备状态 + * @return + */ + @Override + public List> getEquipmentStatus() { + List> res = new ArrayList<>(); + Map res1 = new HashMap<>(); + Map res2 = new HashMap<>(); + Map res3 = new HashMap<>(); + Map res4 = new HashMap<>(); + //在库--1 + int inStock = devInfoMapper.getEquipmentStatus("1"); + res1.put("name","在库"); + res1.put("num",inStock); + //自用--2 + int inUse = devInfoMapper.getEquipmentStatus("2"); + //共享--3 + int share = devInfoMapper.getEquipmentStatus("3"); + res2.put("name","在用"); + res2.put("num",inUse+share); + //维修--5 + int repair = devInfoMapper.getEquipmentStatus("5"); + res3.put("name","在修"); + res3.put("num",repair); + + res4.put("name","共享"); + res4.put("num",share); + int count = inStock+inUse+share+repair; + res1.put("proportion",count > 0 ? (inStock * 100) / count : 0+"%"); + res2.put("proportion",count > 0 ? ((inUse+share) * 100) / count : 0+"%"); + res3.put("proportion",count > 0 ? (repair * 100) / count : 0+"%"); + res4.put("proportion",0); + res.add(res1); + res.add(res2); + res.add(res3); + res.add(res4); + return null; + } + + /** + * 项目装备 + * @return + */ + @Override + public Map getProjectEquipment() { + + Map res = new HashMap<>(); + //年度总投资额 TODO 输入的 + res.put("annualTotal","140.6"); + //在建工程数 TODO e基建2.0获取 + res.put("projectNUm",50); + //在用装备数 + //自用--2 + int inUse = devInfoMapper.getEquipmentStatus("2"); + //共享--3 + int share = devInfoMapper.getEquipmentStatus("3"); + res.put("num",inUse+share); + //在用率 + DevInfoReq devInfoReq = new DevInfoReq(); + Integer totalEquipmentQuantity = devInfoMapper.getTotalEquipment(devInfoReq); + res.put("proportion",totalEquipmentQuantity > 0 ? ((inUse+share) * 100) / totalEquipmentQuantity : 0+"%"); + //周转率 + int devNum = devInfoMapper.getChangeNum(); + res.put("turnoverRate",totalEquipmentQuantity > 0 ? (devNum * 100) / totalEquipmentQuantity : 0+"%"); + return res; + } + + /** + * 各单位装备在用率情况 + * @return + */ + @Override + public List> getDeptEquipment() { + List> res = new ArrayList<>(); + SysDept sysDept = new SysDept(); + List sysDeptList = sysDeptMapper.selectDeptList(sysDept); + for (SysDept sysDeptNew:sysDeptList) { + Map dept = new HashMap<>(); + DevInfoReq devInfoReq = new DevInfoReq(); + devInfoReq.setOwnCo(Math.toIntExact(sysDeptNew.getDeptId())); + //装备总数 + Integer sum = devInfoMapper.getTotalEquipment(devInfoReq); + //自用2 + devInfoReq.setChangeStatus("2"); + Integer inUse = devInfoMapper.getTotalEquipment(devInfoReq); + devInfoReq.setChangeStatus("3"); + Integer share = devInfoMapper.getTotalEquipment(devInfoReq); + inUse = inUse+share; + dept.put("name",sysDeptNew.getDeptName()); + //在用率 + dept.put("proportion",sum > 0 ? (inUse * 100) / sum : 0+"%"); + //周转率 + int turnoverRate = devInfoMapper.getTurnoverRate(); + dept.put("turnoverRate",sum > 0 ? (turnoverRate * 100) / sum : 0+"次/年"); + dept.put("inUse",inUse); + res.add(dept); + } + // 【核心排序逻辑】按proportion数值降序排序(高在用率优先) + Collections.sort(res, new Comparator>() { + @Override + public int compare(Map map1, Map map2) { + // 1. 提取两个map中的proportion字符串 + String proportion1 = (String) map1.get("proportion"); + String proportion2 = (String) map2.get("proportion"); + // 2. 处理null值(默认视为0%) + proportion1 = proportion1 == null ? "0%" : proportion1; + proportion2 = proportion2 == null ? "0%" : proportion2; + // 3. 去掉"%"符号,转为Integer数值(核心步骤) + // 注意:若proportion含小数(如"83.5%"),需转为Double,此处按整数处理(适配原代码逻辑) + int propValue1 = Integer.parseInt(proportion1.replace("%", "")); + int propValue2 = Integer.parseInt(proportion2.replace("%", "")); + // 4. 数值降序排序(高在用率在前);升序用:propValue1 - propValue2 + return propValue2 - propValue1; + } + }); + return res; + } + + /** + * 工程在用装备情况 + * @return + */ + @Override + public List> getEquipmentUse() { + List> res = new ArrayList<>(); + return res; + } + + @Override + public List> getUsageStatistics() { + return null; + } + + /** + * 统计数量 + */ + public void count(Map res,List lineProductionDateList){ + int five = 0; + int fiveOrTen = 0; + int ten = 0; + if (lineProductionDateList.size()>0){ + for (String date :lineProductionDateList){ + int yearDiff = calculateYearDifferenceWithJava8(date); + if (yearDiff<5){ + five++; + }else if(yearDiff>10){ + ten++; + }else { + fiveOrTen++; + } + } + five = lineProductionDateList.size() > 0 ? (five * 100) / lineProductionDateList.size() : 0; + fiveOrTen = lineProductionDateList.size() > 0 ? (fiveOrTen * 100) / lineProductionDateList.size() : 0; + ten = lineProductionDateList.size() > 0 ? (ten * 100) / lineProductionDateList.size() : 0; + } + res.put("five",five+"%"); + res.put("fiveOrTen",fiveOrTen+"%"); + res.put("ten",ten+"%"); + } + + /** + * 计算当前日期与production_date的完整年数差(基于Java 8+ LocalDate) + * @param productionDateStr 生产日期字符串(格式:yyyy-MM-dd,如"2020-05-18") + * @return 年数差(正数:当前日期在production_date之后;负数:当前日期在production_date之前;0:同年) + * @throws DateTimeParseException 若日期字符串格式不符合要求,抛出解析异常 + */ + public static int calculateYearDifferenceWithJava8(String productionDateStr) throws DateTimeParseException { + // 1. 定义日期格式器(匹配输入的production_date字符串格式) + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + + // 2. 将字符串类型的production_date解析为LocalDate对象 + LocalDate productionDate = LocalDate.parse(productionDateStr, formatter); + + // 3. 获取当前系统日期(仅日期,不含时间) + LocalDate currentDate = LocalDate.now(); + + // 4. 计算两个LocalDate之间的周期(Period包含年、月、日差) + Period period = Period.between(productionDate, currentDate); + + // 5. 返回完整年数差(Period的getYears()方法直接返回满1年的数量) + return period.getYears(); + } + + + +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/mapper/OrderMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/mapper/OrderMapper.java index e8136ef..624e571 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/mapper/OrderMapper.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/mapper/OrderMapper.java @@ -34,7 +34,7 @@ public interface OrderMapper { void updateMaStatus(OrderDetailDto orderDetailDto); - Integer updateOrderStatus(@Param("orderId") Integer orderId, @Param("maIds") List maIds, @Param("orderStatus") String orderStatus,@Param("userName") String userName, @Param("remark") String remark); + Integer updateOrderStatus(@Param("orderId") Integer orderId, @Param("maIds") List maIds, @Param("orderStatus") String orderStatus, @Param("userName") String userName, @Param("remark") String remark); Integer updateDevCount(OrderDetailDto orderDetailDto); Integer updateAddDevCount(OrderDetailDto orderDetailDto); diff --git a/bonus-modules/bonus-material-mall/src/main/resources/bootstrap-material_mall_test.yml b/bonus-modules/bonus-material-mall/src/main/resources/bootstrap-material_mall_test.yml new file mode 100644 index 0000000..200552e --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/resources/bootstrap-material_mall_test.yml @@ -0,0 +1,33 @@ +# Tomcat +server: + port: 18589 + +# Spring +spring: + cloud: + nacos: + discovery: + # 服务注册地址 + server-addr: 14.103.246.124:8848 +# server-addr: 192.168.1.2:8848 + namespace: material_mall + ip: 192.168.0.69 + config: + # 配置中心地址 + server-addr: 14.103.246.124:8848 +# server-addr: 192.168.1.2:8848 + namespace: material_mall + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-configs: + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} + +#加密组件 +jasypt: + encryptor: + password: Encrypt + +mybatis: + configuration: + map-underscore-to-camel-case: true \ No newline at end of file diff --git a/bonus-modules/bonus-material-mall/src/main/resources/lib/sms-util-1.0.jar b/bonus-modules/bonus-material-mall/src/main/resources/lib/sms-util-1.0.jar new file mode 100644 index 0000000..7b09355 Binary files /dev/null and b/bonus-modules/bonus-material-mall/src/main/resources/lib/sms-util-1.0.jar differ diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/devchange/DevChangeMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/devchange/DevChangeMapper.xml index 5849971..7b8ab5e 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/devchange/DevChangeMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/devchange/DevChangeMapper.xml @@ -19,7 +19,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" )values ( #{changeId},#{devId},#{useTime},#{reasonId},#{reasonVal},#{remark},#{repairman},#{repairTime},#{repairContent},0 ) + + + insert into cs_device_detials( + pro_id,dev_id, num, type, create_time, update_time) + values (#{proId},#{devId},#{num},#{type},now(),now()) update ma_dev_info set json_data=#{jsonData} where ma_id=#{devId} @@ -29,6 +34,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" change_status=#{changeStatus} where ma_id=#{devId} + + delete from cs_device_detials where id=#{id} + + + + update cs_device_detials set num=#{num} where id=#{id} + @@ -121,8 +152,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" from ma_dev_info where ma_id=#{devId} - + select dev.ma_id devId,dev.device_name devName,dev.code devCode,dev.json_data,DATE(dev.production_date ) productDate ,dev.buy_price buyPrice ,dev.brand , mdq.next_check_time nextDate,mt.typeId, mt.unit_name unit,mt.maintenance_alarm_day , mt.lease_price,mt.proType,mt.level,mt.mainGx,mt.childGx,mt.devCategory ,mt.devSubcategory ,mt.devName, mt.devModel ,bci.company_name compName,bci.operate_address orgName,IFNULL(pro.pro_name,'-') proName, @@ -131,7 +162,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" left join ma_dev_info dev on dcd.dev_id=dev.ma_id left join bm_company_info bci on bci.company_id=dev.own_co left join ma_type_view mt on mt.typeId=dev.type_id - LEFT JOIN ma_dev_qc mdq on dev.ma_id=mdq.ma_id + LEFT JOIN + (SELECT max( next_check_time) next_check_time,ma_id + from ma_dev_qc + GROUP BY ma_id + ) mdq on dev.ma_id=mdq.ma_id left join jj_sing_project pro on pro.pro_code=dev.on_project where is_active=1 and dcd.change_id=#{id} @@ -139,5 +174,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select distinct voltage from jj_sing_project + + \ No newline at end of file diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml index 93dff3a..3cb3fbe 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml @@ -227,6 +227,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" d.ma_id as maId, d.code as code, d.buy_price as buyPrice, + d.device_type as deviceType, d.item_type_model as itemTypeModel, identify_code as identifyCode, d.device_name as deviceName, @@ -288,6 +289,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" device_name, device_weight, + device_type, device_count, code, identify_code, @@ -331,6 +333,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{deviceName}, #{deviceWeight}, + #{deviceType}, #{deviceCount}, #{code}, #{identifyCode}, @@ -1402,4 +1405,84 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ma_lease_info mli LEFT JOIN sys_dept sd ON mli.publish_company = sd.dept_id + + + + + + + + + +