提交 | 用户 | 时间
|
71e81e
|
1 |
package cn.stylefeng.guns.modular.sc.repairManageInfo.service.impl; |
懒 |
2 |
|
|
3 |
import cn.stylefeng.guns.base.auth.context.LoginContext; |
|
4 |
import cn.stylefeng.guns.base.auth.context.LoginContextHolder; |
|
5 |
import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory; |
|
6 |
import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo; |
|
7 |
import cn.stylefeng.guns.modular.om.productionOrdeInfo.entity.ProductionOrdeInfo; |
|
8 |
import cn.stylefeng.guns.modular.om.productionOrdeInfo.service.ProductionOrdeInfoService; |
|
9 |
import cn.stylefeng.guns.modular.rm.recipeManage.model.result.RecipeManageResult; |
|
10 |
import cn.stylefeng.guns.modular.sc.repairManageInfo.entity.RepairManageInfo; |
|
11 |
import cn.stylefeng.guns.modular.sc.repairManageInfo.mapper.RepairManageInfoMapper; |
|
12 |
import cn.stylefeng.guns.modular.sc.repairManageInfo.model.params.RepairManageInfoParam; |
|
13 |
import cn.stylefeng.guns.modular.sc.repairManageInfo.model.result.RepairManageInfoResult; |
|
14 |
import cn.stylefeng.guns.modular.sc.repairManageInfo.service.RepairManageInfoService; |
|
15 |
import cn.stylefeng.roses.core.util.ToolUtil; |
|
16 |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
17 |
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
18 |
import com.baomidou.mybatisplus.extension.api.R; |
|
19 |
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
20 |
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
21 |
import org.springframework.beans.factory.annotation.Autowired; |
|
22 |
import org.springframework.stereotype.Service; |
|
23 |
|
|
24 |
import java.io.Serializable; |
|
25 |
import java.util.Date; |
|
26 |
import java.util.List; |
|
27 |
|
|
28 |
/** |
|
29 |
* <p> |
|
30 |
* 返修管理表 服务实现类 |
|
31 |
* </p> |
|
32 |
* |
|
33 |
* @author ruimin |
|
34 |
* @since 2023-07-31 |
|
35 |
*/ |
|
36 |
@Service |
|
37 |
public class RepairManageInfoServiceImpl extends ServiceImpl<RepairManageInfoMapper, RepairManageInfo> implements RepairManageInfoService { |
|
38 |
|
|
39 |
@Autowired |
|
40 |
private RepairManageInfoService repairManageInfoService; |
|
41 |
|
|
42 |
@Autowired |
|
43 |
private ProductionOrdeInfoService ordeInfoService; |
|
44 |
|
|
45 |
@Override |
|
46 |
public void add(RepairManageInfoParam param){ |
|
47 |
param.setOperateTime(new Date()); |
|
48 |
param.setOperateUser(LoginContextHolder.getContext().getUser().getName()); |
|
49 |
RepairManageInfo entity = getEntity(param); |
|
50 |
this.save(entity); |
|
51 |
} |
|
52 |
|
|
53 |
@Override |
|
54 |
public void delete(RepairManageInfoParam param){ |
|
55 |
this.removeById(getKey(param)); |
|
56 |
} |
|
57 |
|
|
58 |
@Override |
|
59 |
public void update(RepairManageInfoParam param){ |
|
60 |
RepairManageInfo oldEntity = getOldEntity(param); |
|
61 |
RepairManageInfo newEntity = getEntity(param); |
|
62 |
ToolUtil.copyProperties(newEntity, oldEntity); |
|
63 |
this.updateById(newEntity); |
|
64 |
} |
|
65 |
|
|
66 |
@Override |
|
67 |
public RepairManageInfoResult findBySpec(RepairManageInfoParam param){ |
|
68 |
return null; |
|
69 |
} |
|
70 |
|
|
71 |
@Override |
|
72 |
public List<RepairManageInfoResult> findListBySpec(RepairManageInfoParam param){ |
|
73 |
return this.baseMapper.customList(param); |
|
74 |
} |
|
75 |
|
|
76 |
@Override |
|
77 |
public LayuiPageInfo findPageBySpec(RepairManageInfoParam param){ |
|
78 |
Page pageContext = getPageContext(); |
|
79 |
IPage page = this.baseMapper.customPageList(pageContext, param); |
|
80 |
List<RepairManageInfoResult> result = page.getRecords(); |
|
81 |
try { |
|
82 |
for (RepairManageInfoResult repairManageInfoResult : result) { |
|
83 |
switch (repairManageInfoResult.getManageType()){ |
|
84 |
case "2": |
|
85 |
repairManageInfoResult.setManageType("产品上线"); |
|
86 |
break; |
|
87 |
case "1": |
|
88 |
repairManageInfoResult.setManageType("产品下线"); |
|
89 |
break; |
|
90 |
default: |
|
91 |
} |
|
92 |
} |
|
93 |
}catch (Exception e){ |
|
94 |
e.printStackTrace(); |
|
95 |
} |
|
96 |
return LayuiPageFactory.createPageInfo(page); |
|
97 |
} |
|
98 |
|
|
99 |
@Override |
|
100 |
public void editGoLive(RepairManageInfo repairManageInfo) { |
|
101 |
QueryWrapper<RepairManageInfo> wrapper = new QueryWrapper<>(); |
|
102 |
wrapper.eq("sfc",repairManageInfo.getSfc()); |
|
103 |
try { |
|
104 |
String line = repairManageInfo.getProductionLine(); |
|
105 |
if(line.equals("BOP")||line.equals("COP")){ |
|
106 |
ProductionOrdeInfo orderStatus = ordeInfoService.getOne(new QueryWrapper<ProductionOrdeInfo>().eq("order_status", "3")); |
|
107 |
if(orderStatus!=null){ |
|
108 |
repairManageInfo.setWorkOrderNo(orderStatus.getWorkOrderNo()); |
|
109 |
repairManageInfo.setProductCode(orderStatus.getMaterialCode()); |
|
110 |
repairManageInfo.setProductName(orderStatus.getMaterialName()); |
|
111 |
repairManageInfo.setOperateTime(new Date()); |
|
112 |
repairManageInfo.setOperateUser(LoginContextHolder.getContext().getUser().getName()); |
|
113 |
} |
|
114 |
} |
|
115 |
}catch (Exception e){ |
|
116 |
e.printStackTrace(); |
|
117 |
} |
|
118 |
repairManageInfoService.saveOrUpdate(repairManageInfo,wrapper); |
|
119 |
} |
|
120 |
|
|
121 |
private Serializable getKey(RepairManageInfoParam param){ |
|
122 |
return param.getId(); |
|
123 |
} |
|
124 |
|
|
125 |
private Page getPageContext() { |
|
126 |
return LayuiPageFactory.defaultPage(); |
|
127 |
} |
|
128 |
|
|
129 |
private RepairManageInfo getOldEntity(RepairManageInfoParam param) { |
|
130 |
return this.getById(getKey(param)); |
|
131 |
} |
|
132 |
|
|
133 |
private RepairManageInfo getEntity(RepairManageInfoParam param) { |
|
134 |
RepairManageInfo entity = new RepairManageInfo(); |
|
135 |
ToolUtil.copyProperties(param, entity); |
|
136 |
return entity; |
|
137 |
} |
|
138 |
|
|
139 |
} |