Merge remote-tracking branch 'origin/ah-simple' into ah-simple

This commit is contained in:
方亮 2025-09-15 21:52:49 +08:00
commit 39727d504d
19 changed files with 1198 additions and 34 deletions

View File

@ -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<CsDeviceChangeVo> list = service.getDevChangeList(vo);
ExcelUtil<CsDeviceChangeVo> util = new ExcelUtil<CsDeviceChangeVo>(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<DevChangeVo> list = service.getDevDetails(vo);
ExcelUtil<DevChangeVo> util = new ExcelUtil<DevChangeVo>(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));
}
}

View File

@ -8,6 +8,13 @@ public class CsDeviceChangeDetailsVo {
private Integer pageNum;
private Integer pageSize;
private String proId;
private int num=1;
private String type;
/**
* 主键
*/

View File

@ -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;
/**
* 使用人

View File

@ -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;
}
}

View File

@ -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;
/**
* 产权单位

View File

@ -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<CsDeviceChangeDetailsVo> getDevDetails(CsDeviceChangeDetailsVo vo);
List<DevChangeVo> getDevDetails(CsDeviceChangeDetailsVo vo);
/**
* 电压等级
@ -104,4 +101,29 @@ public interface DevChangeMapper {
* @return
*/
List<JjProjectVo> getVoltageLevel(JjProjectVo vo);
/**
* 修改详情
* @param deviceChangeDetailsVo
*/
void addDevChangeDetails(DevChangeDetailsVo deviceChangeDetailsVo);
/**
* 查询数据
* @param vo
* @return
*/
List<DevChangeDetailsVo> getDevChangeDetailsList(DevChangeDetailsVo vo);
/**
*
* @param voo
*/
void deleteDevChangeDetails(DevChangeDetailsVo voo);
/**
* 修改数量
* @param newNum
*/
void updateChangeDetailsNum(DevChangeDetailsVo voo);
}

View File

@ -49,7 +49,7 @@ public interface DevChangeService {
* @param vo
* @return
*/
AjaxResult getDevDetails(CsDeviceChangeDetailsVo vo);
List<DevChangeVo> getDevDetails(CsDeviceChangeDetailsVo vo);
/**
* 电压等级下拉选
@ -57,4 +57,10 @@ public interface DevChangeService {
* @return
*/
List<JjProjectVo> getVoltageLevel(JjProjectVo vo);
AjaxResult updateDevChangeInfo(CsDeviceChangeVo vo);
AjaxResult updateDevChangeInfo2(CsDeviceChangeVo vo);
AjaxResult updateDevChangeInfo3(CsDeviceChangeVo vo);
}

View File

@ -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<CsDeviceChangeDetailsVo> 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<CsDeviceChangeDetailsVo> 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<CsDeviceChangeDetailsVo> 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<DevChangeDetailsVo> list=mapper.getDevChangeDetailsList(vo);
DevChangeDetailsVo devChangeDetailsVo=new DevChangeDetailsVo(devId,proCode,"5",num);
List<DevChangeDetailsVo> 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<DevChangeDetailsVo> list=mapper.getDevChangeDetailsList(vo);
if( "1".equals(type) || "5".equals(type)){
DevChangeDetailsVo devChangeDetailsVo=new DevChangeDetailsVo(devId,proCode,"2",num);
List<DevChangeDetailsVo> 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<DevChangeVo> getDevDetails(CsDeviceChangeDetailsVo vo) {
try{
List<CsDeviceChangeDetailsVo> list=mapper.getDevDetails(vo);
return AjaxResult.success(list);
List<DevChangeVo> list=mapper.getDevDetails(vo);
return list;
}catch (Exception e){
log.error(e.getMessage());
}
return AjaxResult.success(new ArrayList<>());
return new ArrayList<>();
}
@Override

View File

@ -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;

View File

@ -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<SysDept> getDemandUnit(DevInfoVo devInfoVo);
int updateTypeLeasePrice(DevInfo devInfo);
Integer getTotalEquipment(DevInfoReq devInfoReq);
BigDecimal getTotalValue(DevInfoReq devInfoReq);
int getLineNum(DevInfoReq devInfoReq);
BigDecimal getLinePrice(DevInfoReq devInfoReq);
List<String> getLineProductionDateList(DevInfoReq devInfoReq);
List<com.bonus.material.equipment.domain.SysDept> getUnitEquipmentConfiguration();
BigDecimal getPrice(Long deptId);
int getEquipmentStatus(String changeStatus);
int getChangeNum();
int getTurnoverRate();
}

View File

@ -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<String,Object> res = provinceScreenService.getTotalEquipment();
return AjaxResult.success(res);
} catch (Exception e) {
return AjaxResult.error("装备总量,总价值异常");
}
}
/**
*线路装备变电装备电缆装备
* @return
*/
@ApiOperation("线路装备,变电装备,电缆装备")
@GetMapping("/getEquipmentClassification")
public AjaxResult getEquipmentClassification() {
try {
Map<String,Object> res = provinceScreenService.getEquipmentClassification();
return AjaxResult.success(res);
} catch (Exception e) {
return AjaxResult.error("线路装备,变电装备,电缆装备异常");
}
}
/**
* 单位装备配置
* @return
*/
@ApiOperation("单位装备配置")
@GetMapping("/getUnitEquipmentConfiguration")
public AjaxResult getUnitEquipmentConfiguration() {
try {
List<Map<String,Object>> res = provinceScreenService.getUnitEquipmentConfiguration();
return AjaxResult.success(res);
} catch (Exception e) {
return AjaxResult.error("单位装备配置异常");
}
}
/**
* 装备状态
* @return
*/
@ApiOperation("装备状态")
@GetMapping("/getEquipmentStatus")
public AjaxResult getEquipmentStatus() {
try {
List<Map<String,Object>> res = provinceScreenService.getEquipmentStatus();
return AjaxResult.success(res);
} catch (Exception e) {
return AjaxResult.error("装备状态异常");
}
}
/**
* 项目装备
* @return
*/
@ApiOperation("项目装备")
@GetMapping("/getProjectEquipment")
public AjaxResult getProjectEquipment() {
try {
Map<String,Object> res = provinceScreenService.getProjectEquipment();
return AjaxResult.success(res);
} catch (Exception e) {
return AjaxResult.error("项目装备异常");
}
}
/**
* 各单位装备在用率情况
* @return
*/
@ApiOperation("各单位装备在用率情况")
@GetMapping("/getDeptEquipment")
public AjaxResult getDeptEquipment() {
try {
List<Map<String,Object>> res = provinceScreenService.getDeptEquipment();
return AjaxResult.success(res);
} catch (Exception e) {
return AjaxResult.error("项目装备异常");
}
}
/**
* 工程在用装备情况
* @return
*/
@ApiOperation("工程在用装备情况")
@GetMapping("/getEquipmentUse")
public AjaxResult getEquipmentUse() {
try {
List<Map<String,Object>> res = provinceScreenService.getEquipmentUse();
for (int i = 0; i < 10; i++) {
Map<String,Object> 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<Map<String,Object>> res = provinceScreenService.getUsageStatistics();
for (int i = 0; i < 10; i++) {
Map<String,Object> 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("装备在用率统计异常");
}
}
}

View File

@ -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入库 23 出库(2是自用 3共享) 4退役 5维修
*/
public String changeStatus;
}

View File

@ -0,0 +1,51 @@
package com.bonus.material.largeScreen.service;
import java.util.List;
import java.util.Map;
public interface ProvinceScreenService {
/**
* 装备总量总价值
* @return
*/
Map<String, Object> getTotalEquipment();
/**
*线路装备变电装备电缆装备
* @return
*/
Map<String, Object> getEquipmentClassification();
/**
* 单位装备配置
* @return
*/
List<Map<String,Object>> getUnitEquipmentConfiguration();
/**
* 装备状态
* @return
*/
List<Map<String,Object>> getEquipmentStatus();
/**
* 项目装备
* @return
*/
Map<String, Object> getProjectEquipment();
/**
* 各单位装备在用率情况
* @return
*/
List<Map<String, Object>> getDeptEquipment();
/**
* 工程在用装备情况
* @return
*/
List<Map<String, Object>> getEquipmentUse();
List<Map<String, Object>> getUsageStatistics();
}

View File

@ -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<String, Object> getTotalEquipment() {
Map<String,Object> 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<String, Object> getEquipmentClassification() {
Map<String,Object> res = new HashMap<>();
Map<String,Object> res1 = new HashMap<>();
Map<String,Object> res2 = new HashMap<>();
Map<String,Object> 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<String> 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<String> 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<String> 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<Map<String,Object>> getUnitEquipmentConfiguration() {
//获取所有单位 TODO 后期可能单位放到字典表这里要修改
SysDept sysDept = new SysDept();
DevInfoReq devInfoReq = new DevInfoReq();
List<SysDept> sysDeptList = sysDeptMapper.selectDeptList(sysDept);
List<Map<String,Object>> res = new ArrayList<>();
for (SysDept sysDeptNew:sysDeptList) {
Map<String,Object> 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<DeptConfigRateSummary> 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<Map<String,Object>> getEquipmentStatus() {
List<Map<String,Object>> res = new ArrayList<>();
Map<String,Object> res1 = new HashMap<>();
Map<String,Object> res2 = new HashMap<>();
Map<String,Object> res3 = new HashMap<>();
Map<String,Object> 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<String, Object> getProjectEquipment() {
Map<String, Object> 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<Map<String, Object>> getDeptEquipment() {
List<Map<String, Object>> res = new ArrayList<>();
SysDept sysDept = new SysDept();
List<SysDept> sysDeptList = sysDeptMapper.selectDeptList(sysDept);
for (SysDept sysDeptNew:sysDeptList) {
Map<String, Object> 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<Map<String, Object>>() {
@Override
public int compare(Map<String, Object> map1, Map<String, Object> 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<Map<String, Object>> getEquipmentUse() {
List<Map<String, Object>> res = new ArrayList<>();
return res;
}
@Override
public List<Map<String, Object>> getUsageStatistics() {
return null;
}
/**
* 统计数量
*/
public void count(Map<String, Object> res,List<String> 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();
}
}

View File

@ -34,7 +34,7 @@ public interface OrderMapper {
void updateMaStatus(OrderDetailDto orderDetailDto);
Integer updateOrderStatus(@Param("orderId") Integer orderId, @Param("maIds") List<Integer> maIds, @Param("orderStatus") String orderStatus,@Param("userName") String userName, @Param("remark") String remark);
Integer updateOrderStatus(@Param("orderId") Integer orderId, @Param("maIds") List<Integer> maIds, @Param("orderStatus") String orderStatus, @Param("userName") String userName, @Param("remark") String remark);
Integer updateDevCount(OrderDetailDto orderDetailDto);
Integer updateAddDevCount(OrderDetailDto orderDetailDto);

View File

@ -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

View File

@ -19,7 +19,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)values (
#{changeId},#{devId},#{useTime},#{reasonId},#{reasonVal},#{remark},#{repairman},#{repairTime},#{repairContent},0
)
</insert>
<insert id="addDevChangeDetails">
insert into cs_device_detials(
pro_id,dev_id, num, type, create_time, update_time)
values (#{proId},#{devId},#{num},#{type},now(),now())
</insert>
<update id="updateJson">
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}
</update>
<delete id="deleteDevChangeDetails">
delete from cs_device_detials where id=#{id}
</delete>
<!--xiugao1-->
<update id="updateChangeDetailsNum">
update cs_device_detials set num=#{num} where id=#{id}
</update>
<select id="getMaxFeature" resultType="java.lang.Integer">
select count(1) num
from ma_dev_info_properties
@ -43,11 +55,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt.devModel ,bci.company_name compName,bci.operate_address orgName,IFNULL(pro.pro_name,'-') proName,
dev.on_project proId
FROM ma_dev_info dev
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 jj_sing_project pro on pro.pro_code=dev.on_project
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 (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
<if test="proId!=null and proId!=''">
and dev.on_project=#{proId}
</if>
<if test="devName!=null and devName!=''">
and dev.device_name like concat('%',#{devName},'%')
</if>
@ -55,10 +70,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and mt.typeId=#{typeId}
</if>
<if test="status!=null and status!=''">
<if test='status=="0"'>
<if test='status=="2"'>
and dev.change_status in(2,3)
</if>
<if test='status!="0"'>
<if test='status!="2"'>
AND dev.change_status=#{status}
</if>
</if>
@ -81,11 +96,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="getDevChangeList" resultType="com.bonus.material.devchange.domain.CsDeviceChangeVo">
select cds.id,cds.change_status changeStatus,cds.type,cds.status,cds.pro_code proCode,cds.pro_name proName,
cds.pro_type proType,cds.dev_num devNum,cds.voltage_level voltageLevel,
cds.use_unit useUint,cds.pro_province proProvince,cds.pro_city proCity,cds.pro_county proCounty,
cds.pro_location proLocation,cds.create_time createTime,
cds.create_user createUser,cds.del_flag,cds.user_name userName,cds.user_phone userPhone,
cds.change_unit changeUnit
cds.pro_type proType,cds.dev_num devNum,cds.voltage_level voltageLevel,
cds.use_unit useUint,cds.pro_province proProvince,cds.pro_city proCity,cds.pro_county proCounty,
cds.pro_location proLocation,cds.create_time createTime,
cds.create_user createUser,cds.del_flag,cds.user_name userName,cds.user_phone userPhone,
cds.change_unit changeUnit,
CASE
WHEN cds.change_status = 1 THEN '在库'
WHEN cds.change_status = 2 THEN '再用'
WHEN cds.change_status = 3 THEN '退役'
WHEN cds.change_status = 4 THEN '维修'
ELSE '未知'
END
AS changeStatusName
, CASE
WHEN cds.type = 1 THEN '入库'
WHEN cds.type = 2 THEN '出库'
WHEN cds.type = 3 THEN '退役'
WHEN cds.type = 4 THEN '维修'
ELSE '未知'
END
AS typeName
from cs_device_change cds
WHERE cds.del_flag=0
<if test="keyWord!=null and keyWord!=''">
@ -101,10 +132,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
cds.pro_code like concat('%',#{keyWord},'%')
)
</if>
<if test="status!=null and status!=''">
and cds.type=#{status}
<if test="type!=null and type!=''">
and cds.type=#{type}
</if>
<if test="status!=null and status!=''">
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!='' ">
and cds.create_time between #{startTime} and #{endTime}
</if>
</select>
@ -121,8 +152,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from ma_dev_info
where ma_id=#{devId}
</select>
<select id="getDevDetails" resultType="com.bonus.material.devchange.domain.CsDeviceChangeDetailsVo">
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 ,
<select id="getDevDetails" resultType="com.bonus.material.devchange.domain.DevChangeVo">
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}
</select>
@ -139,5 +174,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select distinct voltage
from jj_sing_project
</select>
<select id="getDevChangeDetailsList" resultType="com.bonus.material.devchange.domain.DevChangeDetailsVo">
select id,
pro_id proId,
dev_id devId,
num ,
type,
create_time,
update_time
from cs_device_detials
where dev_id=#{devId} and type=#{type}
<if test="proId!=null and proId!=''">
pro_id=#{proId}
</if>
</select>
</mapper>

View File

@ -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"
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deviceName != null and deviceName != '' ">device_name,</if>
<if test="deviceWeight != null and deviceWeight != '' ">device_weight,</if>
<if test="deviceType != null">device_type,</if>
<if test="deviceCount != null">device_count,</if>
<if test="code != null and code != '' ">code,</if>
<if test="identifyCode != null and identifyCode != '' ">identify_code,</if>
@ -331,6 +333,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
<if test="deviceWeight != null and deviceWeight != ''">#{deviceWeight},</if>
<if test="deviceType != null">#{deviceType},</if>
<if test="deviceCount != null">#{deviceCount},</if>
<if test="code != null and code != ''">#{code},</if>
<if test="identifyCode != null and identifyCode != ''">#{identifyCode},</if>
@ -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
</select>
<select id="getTotalEquipment" resultType="java.lang.Integer">
select count(1) from ma_dev_info where is_active ='1'
<if test="ownCo != null ">
AND own_co = #{ownCo}
</if>
<if test="changeStatus != null ">
AND change_status = #{changeStatus}
</if>
</select>
<select id="getTotalValue" resultType="java.math.BigDecimal">
select SUM(buy_price) from ma_dev_info where is_active ='1'
<if test="ownCo != null ">
AND own_co = #{ownCo}
</if>
</select>
<select id="getLineNum" resultType="java.lang.Integer">
select count(1)
from ma_dev_info mdi
left join ma_type mt on mdi.type_id = mt.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id
left join ma_type mt2 on mt1.parent_id = mt2.type_id
left join ma_type mt3 on mt2.parent_id = mt3.type_id
left join ma_type mt4 on mt3.parent_id = mt4.type_id
left join ma_type mt5 on mt4.parent_id = mt5.type_id
left join ma_type mt6 on mt5.parent_id = mt6.type_id
where mt6.type_id = #{typeId} and mdi.is_active ='1'
</select>
<select id="getLinePrice" resultType="java.math.BigDecimal">
select sum(mdi.buy_price)
from ma_dev_info mdi
left join ma_type mt on mdi.type_id = mt.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id
left join ma_type mt2 on mt1.parent_id = mt2.type_id
left join ma_type mt3 on mt2.parent_id = mt3.type_id
left join ma_type mt4 on mt3.parent_id = mt4.type_id
left join ma_type mt5 on mt4.parent_id = mt5.type_id
left join ma_type mt6 on mt5.parent_id = mt6.type_id
where mt6.type_id = #{typeId} and mdi.is_active ='1'
</select>
<select id="getLineProductionDateList" resultType="java.lang.String">
select production_date
from ma_dev_info mdi
left join ma_type mt on mdi.type_id = mt.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id
left join ma_type mt2 on mt1.parent_id = mt2.type_id
left join ma_type mt3 on mt2.parent_id = mt3.type_id
left join ma_type mt4 on mt3.parent_id = mt4.type_id
left join ma_type mt5 on mt4.parent_id = mt5.type_id
left join ma_type mt6 on mt5.parent_id = mt6.type_id
where mt6.type_id = #{typeId} and mdi.is_active ='1'
</select>
<select id="getUnitEquipmentConfiguration" resultType="com.bonus.material.equipment.domain.SysDept">
select production_date
from ma_dev_info mdi
left join ma_type mt on mdi.type_id = mt.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id
left join ma_type mt2 on mt1.parent_id = mt2.type_id
left join ma_type mt3 on mt2.parent_id = mt3.type_id
left join ma_type mt4 on mt3.parent_id = mt4.type_id
left join ma_type mt5 on mt4.parent_id = mt5.type_id
left join ma_type mt6 on mt5.parent_id = mt6.type_id
where mt6.type_id = #{id} and mdi.is_active ='1'
</select>
<select id="getPrice" resultType="java.math.BigDecimal">
select SUM(buy_price) from ma_dev_info where is_active ='1' and own_co = #{deptId}
</select>
<select id="getEquipmentStatus" resultType="java.lang.Integer">
select count(1) from ma_dev_info where is_active ='1' and change_status = #{changeStatus}
</select>
<select id="getChangeNum" resultType="java.lang.Integer">
select SUM(dev_num) from cs_device_change where del_flag ='0'
AND create_time >= DATE_SUB(CURDATE(), INTERVAL 12 MONTH);
</select>
<select id="getTurnoverRate" resultType="java.lang.Integer">
select count(1) from cs_device_change_details cdcd
left join cs_device_change cdc on cdcd.change_id = cdc.id
left join ma_dev_info mdi on mdi.ma_id = cdcd.dev_id
where cdcd.del_flag = '0'
AND cdc.create_time >= DATE_SUB(CURDATE(), INTERVAL 12 MONTH);
</select>
</mapper>