Merge remote-tracking branch 'origin/master' into master
正在显示
29 个修改的文件
包含
569 行增加
和
166 行删除
... | @@ -217,17 +217,31 @@ public class ReportViewUtil { | ... | @@ -217,17 +217,31 @@ public class ReportViewUtil { |
217 | return sb.toString(); | 217 | return sb.toString(); |
218 | } | 218 | } |
219 | 219 | ||
220 | /*****************************************************/ | 220 | |
221 | /*** | 221 | /** |
222 | * 构造填报报表视图:按照部门分组统计 | 222 | * 构造填报报表视图,时间模糊搜索 |
223 | * @param reportId 报表编号 | 223 | * * </pre> |
224 | * @param fields 查询字段 | 224 | * * @param reportId 报表id |
225 | * @param startTime 开始时间 | 225 | * * @param fields 查询字段 |
226 | * @param endTime 结束时间 | 226 | * * @param departIds 厂站集合 |
227 | * * @param dataTime 开始时间 | ||
228 | * * @param dataTime 结束时间 | ||
229 | * @param operatorSign 运算符号 avg sum max min | ||
227 | * @return | 230 | * @return |
228 | */ | 231 | */ |
229 | public static String buildViewByStatistics(String reportId,String fields,String startTime,String endTime) { | 232 | public static String buildViewLike(String reportId,String fields,String departIds,String startTime,String endTime,String operatorSign) { |
233 | |||
234 | //运算符号operatorSign | ||
235 | if(StringUtils.isEmpty(operatorSign)) operatorSign = "sum"; | ||
236 | String inSqlPart = ""; | ||
230 | String inItemSqlPart = ""; | 237 | String inItemSqlPart = ""; |
238 | if(StringUtils.isNotEmpty(departIds)){ | ||
239 | String[] departIdArray = departIds.split(","); | ||
240 | for(String departId : departIdArray) { | ||
241 | inSqlPart = inSqlPart + ",'"+departId+"'"; | ||
242 | } | ||
243 | inSqlPart = inSqlPart.substring(1); | ||
244 | } | ||
231 | if(!StringUtils.isEmpty(fields)) { | 245 | if(!StringUtils.isEmpty(fields)) { |
232 | String[] fieldArray = fields.split(","); | 246 | String[] fieldArray = fields.split(","); |
233 | for(String field : fieldArray) { | 247 | for(String field : fieldArray) { |
... | @@ -242,6 +256,7 @@ public class ReportViewUtil { | ... | @@ -242,6 +256,7 @@ public class ReportViewUtil { |
242 | } | 256 | } |
243 | inItemSqlPart = inItemSqlPart.substring(1); | 257 | inItemSqlPart = inItemSqlPart.substring(1); |
244 | } | 258 | } |
259 | |||
245 | JdbcTemplate masterDB = (JdbcTemplate)SpringContextUtils.getBean("master"); | 260 | JdbcTemplate masterDB = (JdbcTemplate)SpringContextUtils.getBean("master"); |
246 | String itemSql = "select item_code,id from f_report_item where report_id = '"+reportId+"' and required = 1 "; | 261 | String itemSql = "select item_code,id from f_report_item where report_id = '"+reportId+"' and required = 1 "; |
247 | if(!StringUtils.isEmpty(inItemSqlPart)) { | 262 | if(!StringUtils.isEmpty(inItemSqlPart)) { |
... | @@ -256,18 +271,27 @@ public class ReportViewUtil { | ... | @@ -256,18 +271,27 @@ public class ReportViewUtil { |
256 | for(Map<String,Object> itemMap : itemList) { | 271 | for(Map<String,Object> itemMap : itemList) { |
257 | itemCodes = itemCodes + ",'"+itemMap.get("item_code")+"'"; | 272 | itemCodes = itemCodes + ",'"+itemMap.get("item_code")+"'"; |
258 | itemIds = itemIds +",'"+itemMap.get("id")+"'"; | 273 | itemIds = itemIds +",'"+itemMap.get("id")+"'"; |
259 | sb.append("sum(if((`d`.`item_code` = '"+itemMap.get("item_code")+"'),`a`.`item_value`,NULL)) AS `"+itemMap.get("item_code")+"`,"); | 274 | sb.append( operatorSign + "(if((`d`.`item_code` = '"+itemMap.get("item_code")+"'),`a`.`item_value`,NULL)) AS `"+itemMap.get("item_code")+"`,"); |
260 | } | 275 | } |
261 | if(!StringUtils.isEmpty(itemIds)) { | 276 | if(!StringUtils.isEmpty(itemIds)) { |
262 | itemIds = itemIds.substring(1); | 277 | itemIds = itemIds.substring(1); |
263 | } | 278 | } |
264 | sb.append("`a`.`depart_id` AS `depart_id` from (( "); | 279 | sb.append("`a`.`depart_id` AS `depart_id` from (( "); |
280 | sb.append("SELECT data_id,reit_id,item_value,data_time,depart_id FROM f_report_itemv WHERE 1=1 "); | ||
265 | 281 | ||
266 | sb.append("SELECT data_id,reit_id,item_value,data_time,depart_id FROM f_report_itemv v WHERE 1=1 "); | 282 | if(!StringUtils.isEmpty(departIds)) { |
283 | sb.append(" and depart_id in ("+inSqlPart+")"); | ||
284 | } | ||
267 | if(!StringUtils.isEmpty(startTime)) { | 285 | if(!StringUtils.isEmpty(startTime)) { |
268 | sb.append("and data_time>='"+startTime+"' and data_time<='"+endTime+"' "); | 286 | sb.append("and data_time >='"+startTime+"'"); |
269 | } | 287 | } |
270 | sb.append("and reit_id in ("+itemIds+")) `a` left join `f_report_item` `d` on(`a`.`reit_id` = `d`.`id`)) where 1=1 group by `a`.`depart_id`)"); | 288 | if(!StringUtils.isEmpty(endTime)) { |
289 | sb.append("and data_time <='"+endTime+"'"); | ||
290 | } | ||
291 | sb.append("and reit_id in ("+itemIds+")"); | ||
292 | |||
293 | sb.append(") `a` left join `f_report_item` `d` on((`a`.`reit_id` = `d`.`id`))) where 1=1 group by `a`.`depart_id`)"); | ||
271 | return sb.toString(); | 294 | return sb.toString(); |
272 | } | 295 | } |
296 | |||
273 | } | 297 | } | ... | ... |
... | @@ -27,11 +27,18 @@ public interface CommonSqlMapper { | ... | @@ -27,11 +27,18 @@ public interface CommonSqlMapper { |
27 | 27 | ||
28 | Page<Map<String, Object>> queryWrapperForPage(Page<?> page, @Param("sql") String sql, @Param(Constants.WRAPPER) QueryWrapper<?> queryWrapper); | 28 | Page<Map<String, Object>> queryWrapperForPage(Page<?> page, @Param("sql") String sql, @Param(Constants.WRAPPER) QueryWrapper<?> queryWrapper); |
29 | 29 | ||
30 | |||
30 | @Anonymous | 31 | @Anonymous |
31 | List<Map<String, Object>> queryForList(@Param("sql") String sql); | 32 | List<Map<String, Object>> queryForList(@Param("sql") String sql); |
32 | 33 | ||
33 | List<Map<String, Object>> queryWrapperForList(@Param("sql") String sql, @Param(Constants.WRAPPER) QueryWrapper<?> queryWrapper); | 34 | List<Map<String, Object>> queryWrapperForList(@Param("sql") String sql, @Param(Constants.WRAPPER) QueryWrapper<?> queryWrapper); |
34 | 35 | ||
36 | String queryForString(@Param("sql") String sql); | ||
37 | |||
38 | String queryWrapperForString(@Param("sql") String sql, @Param(Constants.WRAPPER) QueryWrapper<?> queryWrapper); | ||
39 | |||
40 | |||
41 | |||
35 | Integer update(@Param("sql") String sql); | 42 | Integer update(@Param("sql") String sql); |
36 | 43 | ||
37 | Integer updateWrapper(@Param("tableName") String tableName, @Param(Constants.WRAPPER) UpdateWrapper<?> updateWrapper); | 44 | Integer updateWrapper(@Param("tableName") String tableName, @Param(Constants.WRAPPER) UpdateWrapper<?> updateWrapper); | ... | ... |
... | @@ -26,6 +26,14 @@ | ... | @@ -26,6 +26,14 @@ |
26 | ${sql} ${ew.customSqlSegment} | 26 | ${sql} ${ew.customSqlSegment} |
27 | </select> | 27 | </select> |
28 | 28 | ||
29 | |||
30 | <select id="queryForString" resultType="java.lang.String"> | ||
31 | ${sql} | ||
32 | </select> | ||
33 | <select id="queryWrapperForString" resultType="java.lang.String" parameterType="java.lang.String"> | ||
34 | ${sql} ${ew.customSqlSegment} | ||
35 | </select> | ||
36 | |||
29 | <update id="update"> | 37 | <update id="update"> |
30 | ${sql} | 38 | ${sql} |
31 | </update> | 39 | </update> | ... | ... |
... | @@ -28,6 +28,10 @@ public interface ICommonSqlService { | ... | @@ -28,6 +28,10 @@ public interface ICommonSqlService { |
28 | 28 | ||
29 | List<Map<String, Object>> queryWrapperForList(String sql, QueryWrapper<?> queryWrapper); | 29 | List<Map<String, Object>> queryWrapperForList(String sql, QueryWrapper<?> queryWrapper); |
30 | 30 | ||
31 | String queryForString(String sql); | ||
32 | |||
33 | String queryWrapperForString(String sql, QueryWrapper<?> queryWrapper); | ||
34 | |||
31 | Integer update(String sql); | 35 | Integer update(String sql); |
32 | 36 | ||
33 | Integer updateWrapper(String tableName, UpdateWrapper<?> updateWrapper); | 37 | Integer updateWrapper(String tableName, UpdateWrapper<?> updateWrapper); | ... | ... |
... | @@ -46,12 +46,23 @@ public class CommonSqlServiceImpl implements ICommonSqlService { | ... | @@ -46,12 +46,23 @@ public class CommonSqlServiceImpl implements ICommonSqlService { |
46 | return commonSqlMapper.queryForList(sql); | 46 | return commonSqlMapper.queryForList(sql); |
47 | } | 47 | } |
48 | 48 | ||
49 | |||
49 | @Override | 50 | @Override |
50 | public List<Map<String, Object>> queryWrapperForList(String sql, QueryWrapper<?> queryWrapper) { | 51 | public List<Map<String, Object>> queryWrapperForList(String sql, QueryWrapper<?> queryWrapper) { |
51 | return commonSqlMapper.queryWrapperForList(sql, queryWrapper); | 52 | return commonSqlMapper.queryWrapperForList(sql, queryWrapper); |
52 | } | 53 | } |
53 | 54 | ||
54 | @Override | 55 | @Override |
56 | public String queryForString(String sql) { | ||
57 | return commonSqlMapper.queryForString(sql); | ||
58 | } | ||
59 | |||
60 | @Override | ||
61 | public String queryWrapperForString(String sql, QueryWrapper<?> queryWrapper) { | ||
62 | return commonSqlMapper.queryWrapperForString(sql, queryWrapper); | ||
63 | } | ||
64 | |||
65 | @Override | ||
55 | public Integer update(String sql) { | 66 | public Integer update(String sql) { |
56 | return commonSqlMapper.update(sql); | 67 | return commonSqlMapper.update(sql); |
57 | } | 68 | } | ... | ... |
1 | package com.skua.modules.common.vo; | ||
2 | |||
3 | import com.skua.core.util.DateUtils; | ||
4 | import io.swagger.annotations.ApiModelProperty; | ||
5 | import lombok.Data; | ||
6 | import org.apache.commons.lang3.StringUtils; | ||
7 | |||
8 | import java.text.ParseException; | ||
9 | import java.text.SimpleDateFormat; | ||
10 | import java.util.Calendar; | ||
11 | import java.util.Date; | ||
12 | |||
13 | @Data | ||
14 | public class DateVO { | ||
15 | |||
16 | @ApiModelProperty(value = "去年(yyyy)") | ||
17 | private int lastYear; | ||
18 | |||
19 | @ApiModelProperty(value = "去年(yyyy-MM)") | ||
20 | private String lastYearMonth; | ||
21 | @ApiModelProperty(value = "去年(yyyy-MM-dd)") | ||
22 | private String lastYearStartDate; | ||
23 | @ApiModelProperty(value = "去年(yyyy-MM-dd)") | ||
24 | private String lastYearEndDate; | ||
25 | |||
26 | |||
27 | @ApiModelProperty(value = "上月(yyyy-MM)") | ||
28 | private String lastMonth; | ||
29 | |||
30 | @ApiModelProperty(value = "上月(yyyy-MM-dd)") | ||
31 | private String lastMonthDay; | ||
32 | |||
33 | |||
34 | @ApiModelProperty(value = "昨天") | ||
35 | private String yesterday; | ||
36 | |||
37 | @ApiModelProperty(value = "当月(yyyy)") | ||
38 | private int nowYear; | ||
39 | |||
40 | @ApiModelProperty(value = "当月(yyyy-MM)") | ||
41 | private String nowMonth; | ||
42 | |||
43 | @ApiModelProperty(value = "当月(yyyy-MM-dd)") | ||
44 | private String nowMonthStartDate; | ||
45 | |||
46 | @ApiModelProperty(value = "当月(yyyy-MM-dd)") | ||
47 | private String nowMonthEndDate; | ||
48 | |||
49 | @ApiModelProperty(value = "当月(yyyy-MM-dd)") | ||
50 | private String nowYearStartDate; | ||
51 | @ApiModelProperty(value = "当月(yyyy-MM-dd)") | ||
52 | private String nowYearEndDate; | ||
53 | |||
54 | |||
55 | public DateVO(String currentDate) { | ||
56 | this.nowMonth = DateUtils.dateformat(currentDate,"yyyy-MM"); | ||
57 | this.nowMonthStartDate = nowMonth+"-01"; | ||
58 | this.nowMonthEndDate = nowMonth+"-31"; | ||
59 | |||
60 | |||
61 | //this.lastYear = getYear(nowMonth,"yyyy-MM")-1; | ||
62 | //this.lastMonth = DateUtils.getLastMonthOfMonth(nowMonth); | ||
63 | nowYear = Integer.parseInt( DateUtils.dateformat(currentDate,"yyyy") ) ; | ||
64 | nowYearStartDate = nowYear + "-01-01"; | ||
65 | nowYearEndDate = nowYear + "-12-31"; | ||
66 | /* this.lastMonthStartTime = lastMonth+"-01"; | ||
67 | this.lastMonthEndTime = lastMonth+"-31"; | ||
68 | |||
69 | this.lastYearStartTime = lastYear+"-01"; | ||
70 | this.lastYearEndTime = lastYear +"-31";*/ | ||
71 | } | ||
72 | } |
1 | package com.skua.tool.util; | 1 | package com.skua.tool.util; |
2 | 2 | ||
3 | import com.skua.constant.BaseConstant; | 3 | import com.skua.constant.BaseConstant; |
4 | |||
5 | import java.math.BigDecimal; | 4 | import java.math.BigDecimal; |
5 | import java.text.ParseException; | ||
6 | import java.text.ParsePosition; | 6 | import java.text.ParsePosition; |
7 | import java.text.SimpleDateFormat; | 7 | import java.text.SimpleDateFormat; |
8 | import java.time.DayOfWeek; | 8 | import java.time.DayOfWeek; |
9 | import java.time.LocalDate; | ||
10 | import java.time.LocalDateTime; | 9 | import java.time.LocalDateTime; |
11 | import java.time.YearMonth; | 10 | import java.time.YearMonth; |
12 | import java.time.format.DateTimeFormatter; | 11 | import java.time.format.DateTimeFormatter; | ... | ... |
... | @@ -339,10 +339,12 @@ public class MaterialINController { | ... | @@ -339,10 +339,12 @@ public class MaterialINController { |
339 | Result<MaterialINVO> result = new Result<MaterialINVO>(); | 339 | Result<MaterialINVO> result = new Result<MaterialINVO>(); |
340 | try { | 340 | try { |
341 | materialINService.auditMaterialINVO(materialINVO); | 341 | materialINService.auditMaterialINVO(materialINVO); |
342 | } catch (Exception e) { | ||
343 | log.error("审批失败",e.getMessage()); | ||
344 | result.setResult(materialINVO); | 342 | result.setResult(materialINVO); |
345 | result.setSuccess(true); | 343 | result.setSuccess(true); |
344 | } catch (Exception e) { | ||
345 | log.error("审批失败",e.getMessage()); | ||
346 | |||
347 | result.error500("审批失败:"+e.getMessage()); | ||
346 | } | 348 | } |
347 | return result; | 349 | return result; |
348 | } | 350 | } | ... | ... |
... | @@ -25,7 +25,9 @@ | ... | @@ -25,7 +25,9 @@ |
25 | <!-- 校验货号是否唯一 --> | 25 | <!-- 校验货号是否唯一 --> |
26 | <select id="checkGoodCodeAndDepartId" resultType="java.lang.Integer"> | 26 | <select id="checkGoodCodeAndDepartId" resultType="java.lang.Integer"> |
27 | select count(1) from erp_distribut_material | 27 | select count(1) from erp_distribut_material |
28 | where good_code = #{goodCode} and depart_id = #{departId} | 28 | where good_code = #{goodCode} |
29 | <if test="departId != null and departId !=''">a and depart_id = #{departId}</if> | ||
30 | |||
29 | </select> | 31 | </select> |
30 | 32 | ||
31 | 33 | ... | ... |
... | @@ -6,7 +6,7 @@ | ... | @@ -6,7 +6,7 @@ |
6 | <select id="getListByDistributId" resultType="com.skua.modules.erp.entity.ERPPurchaseContract"> | 6 | <select id="getListByDistributId" resultType="com.skua.modules.erp.entity.ERPPurchaseContract"> |
7 | select pc.* from erp_purchase_contract pc where pc.id in ( | 7 | select pc.* from erp_purchase_contract pc where pc.id in ( |
8 | select DISTINCT pm.contract_id from erp_purchase_material pm , erp_distribut_material dm | 8 | select DISTINCT pm.contract_id from erp_purchase_material pm , erp_distribut_material dm |
9 | where dm.good_code = dm.good_code and dm.contract_id = '1849328644967497730' | 9 | where pm.good_code = dm.good_code and dm.contract_id = #{distributContractId} |
10 | ) | 10 | ) |
11 | and pc.status = 3 | 11 | and pc.status = 3 |
12 | order by pc.create_time desc | 12 | order by pc.create_time desc | ... | ... |
... | @@ -17,7 +17,7 @@ public interface IMaterialINService extends IService<MaterialIN> { | ... | @@ -17,7 +17,7 @@ public interface IMaterialINService extends IService<MaterialIN> { |
17 | * 审核药剂入库单 | 17 | * 审核药剂入库单 |
18 | * @param materialINVO | 18 | * @param materialINVO |
19 | */ | 19 | */ |
20 | String auditMaterialINVO(MaterialINVO materialINVO); | 20 | String auditMaterialINVO(MaterialINVO materialINVO) throws Exception; |
21 | 21 | ||
22 | /*** | 22 | /*** |
23 | * 列表查询到货记录列表 | 23 | * 列表查询到货记录列表 | ... | ... |
... | @@ -13,6 +13,7 @@ import com.skua.modules.erp.service.IDistributContractService; | ... | @@ -13,6 +13,7 @@ import com.skua.modules.erp.service.IDistributContractService; |
13 | import com.skua.modules.erp.vo.DistributContractVO; | 13 | import com.skua.modules.erp.vo.DistributContractVO; |
14 | import com.skua.modules.erp.vo.PurchasePlanVO; | 14 | import com.skua.modules.erp.vo.PurchasePlanVO; |
15 | import com.skua.modules.system.mapper.SysDepartMapper; | 15 | import com.skua.modules.system.mapper.SysDepartMapper; |
16 | import org.apache.commons.lang3.StringUtils; | ||
16 | import org.springframework.beans.BeanUtils; | 17 | import org.springframework.beans.BeanUtils; |
17 | import org.springframework.beans.factory.annotation.Autowired; | 18 | import org.springframework.beans.factory.annotation.Autowired; |
18 | import org.springframework.stereotype.Service; | 19 | import org.springframework.stereotype.Service; |
... | @@ -47,26 +48,34 @@ public class DistributContractServiceImpl extends ServiceImpl<DistributContractM | ... | @@ -47,26 +48,34 @@ public class DistributContractServiceImpl extends ServiceImpl<DistributContractM |
47 | String goodsCode = checkSameGoodCode(distributContractVO.getMaterialList()); | 48 | String goodsCode = checkSameGoodCode(distributContractVO.getMaterialList()); |
48 | if(goodsCode != null ){ | 49 | if(goodsCode != null ){ |
49 | errMsg ="操作失败,货号["+ goodsCode +"]重复!"; | 50 | errMsg ="操作失败,货号["+ goodsCode +"]重复!"; |
51 | return errMsg; | ||
50 | } | 52 | } |
51 | int count = 0; | 53 | int count = 0; |
52 | if(!distributContractVO.getContractCode().equals(oldContractCode)){ | 54 | |
55 | if(StringUtils.isNotEmpty(oldContractCode)) { | ||
56 | if (!oldContractCode.equals(distributContractVO.getContractCode())) {//修改 | ||
57 | count = this.baseMapper.checkContractCode(distributContractVO.getContractCode() ); | ||
58 | if(count > 0 ){ | ||
59 | errMsg = "合同编号["+distributContractVO.getContractCode()+"]重复"; | ||
60 | } | ||
61 | } | ||
62 | }else{//新增 | ||
53 | count = this.baseMapper.checkContractCode(distributContractVO.getContractCode() ); | 63 | count = this.baseMapper.checkContractCode(distributContractVO.getContractCode() ); |
54 | if(count > checkCount ){ | 64 | if(count > 0 ){ |
55 | errMsg = "合同编号["+distributContractVO.getContractCode()+"]重复"; | 65 | errMsg = "合同编号["+distributContractVO.getContractCode()+"]重复"; |
56 | } | 66 | } |
57 | } | 67 | } |
58 | 68 | ||
59 | if( errMsg == null && distributContractVO.getMaterialList() != null && !distributContractVO.getMaterialList().isEmpty()){ | 69 | if( distributContractVO.getMaterialList() != null && !distributContractVO.getMaterialList().isEmpty()){ |
60 | for(DistributMaterial material : distributContractVO.getMaterialList()){ | 70 | for(DistributMaterial material : distributContractVO.getMaterialList()){ |
61 | //根据deptid与goodscode校验 | 71 | //根据deptid与goodscode校验 |
62 | count = checkGoodCodeAndDepartId( material.getGoodCode(),distributContractVO.getDepartId() ); | 72 | count = checkGoodCodeAndDepartId( material.getGoodCode(),null ); |
63 | if(count > 0 ){ | 73 | if(count > checkCount ){ |
64 | errMsg = "所属厂站["+departMapper.selectById(distributContractVO.getDepartId()).getDepartName()+"]下的货号["+material.getGoodCode()+"]已经分销过!"; | 74 | errMsg = "所属厂站["+departMapper.selectById(distributContractVO.getDepartId()).getDepartName()+"]下的货号["+material.getGoodCode()+"]已经分销过!"; |
65 | break; | 75 | break; |
66 | } | 76 | } |
67 | } | 77 | } |
68 | } | 78 | } |
69 | |||
70 | return errMsg; | 79 | return errMsg; |
71 | } | 80 | } |
72 | 81 | ... | ... |
... | @@ -51,17 +51,25 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr | ... | @@ -51,17 +51,25 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr |
51 | String result = null; | 51 | String result = null; |
52 | int count = 0; | 52 | int count = 0; |
53 | 53 | ||
54 | if(!purchaseContractVO.getContractCode().equals(oldContractCode)){ | 54 | if(StringUtils.isNotEmpty(oldContractCode)){ |
55 | if( ! oldContractCode.equals( purchaseContractVO.getContractCode() )){ | ||
56 | count = purchaseMaterialMapper.checkContractCode(purchaseContractVO.getContractCode() ); | ||
57 | if(count > 0 ){ | ||
58 | result = "合同编号["+purchaseContractVO.getContractCode()+"]重复"; | ||
59 | return result; | ||
60 | } | ||
61 | } | ||
62 | }else{ | ||
55 | count = purchaseMaterialMapper.checkContractCode(purchaseContractVO.getContractCode() ); | 63 | count = purchaseMaterialMapper.checkContractCode(purchaseContractVO.getContractCode() ); |
56 | if(count > checkCount ){ | 64 | if(count > 0 ){ |
57 | result = "合同编号["+purchaseContractVO.getContractCode()+"]重复"; | 65 | result = "合同编号["+purchaseContractVO.getContractCode()+"]重复"; |
66 | return result; | ||
58 | } | 67 | } |
59 | } | 68 | } |
60 | 69 | if( purchaseContractVO.getMaterialList()!= null && !purchaseContractVO.getMaterialList().isEmpty()){ | |
61 | if( result == null && purchaseContractVO.getMaterialList()!= null && !purchaseContractVO.getMaterialList().isEmpty()){ | ||
62 | for(PurchaseMaterial purchaseMaterial : purchaseContractVO.getMaterialList()){ | 70 | for(PurchaseMaterial purchaseMaterial : purchaseContractVO.getMaterialList()){ |
63 | if(StringUtils.isNotEmpty(purchaseMaterial.getGoodCode())){ | 71 | if(StringUtils.isNotEmpty(purchaseMaterial.getGoodCode())){ |
64 | count = purchaseMaterialMapper.checkGoodCode(purchaseMaterial.getId(),purchaseMaterial.getGoodCode()); | 72 | count = purchaseMaterialMapper.checkGoodCode(null,purchaseMaterial.getGoodCode()); |
65 | if(count > checkCount ){ | 73 | if(count > checkCount ){ |
66 | result = "校验失败,货号[ "+purchaseMaterial.getGoodCode()+" ]已经存在!" ; | 74 | result = "校验失败,货号[ "+purchaseMaterial.getGoodCode()+" ]已经存在!" ; |
67 | break; | 75 | break; | ... | ... |
... | @@ -6,20 +6,27 @@ import com.skua.core.context.BaseContextHandler; | ... | @@ -6,20 +6,27 @@ import com.skua.core.context.BaseContextHandler; |
6 | import com.skua.core.context.SpringContextUtils; | 6 | import com.skua.core.context.SpringContextUtils; |
7 | import com.skua.modules.equipment.dto.EquipmentInDTO; | 7 | import com.skua.modules.equipment.dto.EquipmentInDTO; |
8 | import com.skua.modules.equipment.dto.EquipmentOutDTO; | 8 | import com.skua.modules.equipment.dto.EquipmentOutDTO; |
9 | import com.skua.modules.equipment.entity.EquipmentIn; | ||
9 | import com.skua.modules.equipment.entity.EquipmentInChild; | 10 | import com.skua.modules.equipment.entity.EquipmentInChild; |
11 | import com.skua.modules.equipment.entity.EquipmentOutChild; | ||
10 | import com.skua.modules.equipment.service.IEquipmentInService; | 12 | import com.skua.modules.equipment.service.IEquipmentInService; |
11 | import com.skua.modules.equipment.service.IEquipmentOutService; | 13 | import com.skua.modules.equipment.service.IEquipmentOutService; |
12 | import com.skua.modules.erp.entity.ApproveRecord; | 14 | import com.skua.modules.erp.entity.ApproveRecord; |
15 | import com.skua.modules.erp.entity.ERPPurchaseContract; | ||
13 | import com.skua.modules.erp.entity.MaterialIN; | 16 | import com.skua.modules.erp.entity.MaterialIN; |
14 | import com.skua.modules.erp.mapper.ApproveRecordMapper; | 17 | import com.skua.modules.erp.mapper.ApproveRecordMapper; |
18 | import com.skua.modules.erp.mapper.ERPPurchaseContractMapper; | ||
15 | import com.skua.modules.erp.mapper.MaterialINMapper; | 19 | import com.skua.modules.erp.mapper.MaterialINMapper; |
20 | import com.skua.modules.erp.service.IERPPurchaseContractService; | ||
16 | import com.skua.modules.erp.service.IMaterialINService; | 21 | import com.skua.modules.erp.service.IMaterialINService; |
17 | import com.skua.modules.erp.vo.ArrivalRecordExcelExportVO; | 22 | import com.skua.modules.erp.vo.ArrivalRecordExcelExportVO; |
18 | import com.skua.modules.erp.vo.MaterialINVO; | 23 | import com.skua.modules.erp.vo.MaterialINVO; |
19 | import com.skua.modules.guest.util.DateUtil; | 24 | import com.skua.modules.guest.util.DateUtil; |
25 | import com.skua.modules.quartz.util.BaseUtil; | ||
20 | import com.skua.modules.supplies.entity.SuppliesWarehouse; | 26 | import com.skua.modules.supplies.entity.SuppliesWarehouse; |
21 | import com.skua.modules.supplies.service.ISuppliesWarehouseService; | 27 | import com.skua.modules.supplies.service.ISuppliesWarehouseService; |
22 | import org.apache.commons.lang3.StringUtils; | 28 | import org.apache.commons.lang3.StringUtils; |
29 | import org.hibernate.service.spi.ServiceException; | ||
23 | import org.springframework.beans.factory.annotation.Autowired; | 30 | import org.springframework.beans.factory.annotation.Autowired; |
24 | import org.springframework.jdbc.core.JdbcTemplate; | 31 | import org.springframework.jdbc.core.JdbcTemplate; |
25 | import org.springframework.stereotype.Service; | 32 | import org.springframework.stereotype.Service; |
... | @@ -41,6 +48,8 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia | ... | @@ -41,6 +48,8 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia |
41 | @Resource | 48 | @Resource |
42 | private ApproveRecordMapper recordMapper; | 49 | private ApproveRecordMapper recordMapper; |
43 | @Autowired | 50 | @Autowired |
51 | private IERPPurchaseContractService purchaseContractService; | ||
52 | @Autowired | ||
44 | private IEquipmentInService equipmentInService; | 53 | private IEquipmentInService equipmentInService; |
45 | @Autowired | 54 | @Autowired |
46 | private IEquipmentOutService equipmentOutService; | 55 | private IEquipmentOutService equipmentOutService; |
... | @@ -52,7 +61,7 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia | ... | @@ -52,7 +61,7 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia |
52 | * @param materialINVO | 61 | * @param materialINVO |
53 | */ | 62 | */ |
54 | @Transactional | 63 | @Transactional |
55 | public String auditMaterialINVO(MaterialINVO materialINVO){ | 64 | public String auditMaterialINVO(MaterialINVO materialINVO)throws Exception { |
56 | boolean inAndOutStock = false; | 65 | boolean inAndOutStock = false; |
57 | String errMsg = null; | 66 | String errMsg = null; |
58 | QueryWrapper<SuppliesWarehouse> queryWrapper = new QueryWrapper<SuppliesWarehouse>(); | 67 | QueryWrapper<SuppliesWarehouse> queryWrapper = new QueryWrapper<SuppliesWarehouse>(); |
... | @@ -68,32 +77,29 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia | ... | @@ -68,32 +77,29 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia |
68 | return "所属厂站["+departName+"]下没有找到仓库信息!"; | 77 | return "所属厂站["+departName+"]下没有找到仓库信息!"; |
69 | } | 78 | } |
70 | //保存 | 79 | //保存 |
80 | MaterialIN materialINTemp = this.baseMapper.selectById(materialINVO.getId()); | ||
71 | //purchasePlan.getApproveState() 审批状态 1通过2不通过 | 81 | //purchasePlan.getApproveState() 审批状态 1通过2不通过 |
72 | if("1".equals( materialINVO.getApproveState() )){ | 82 | if("1".equals( materialINVO.getApproveState() )){ |
73 | materialINVO.setAuditStatus( "3" ); | 83 | materialINTemp.setAuditStatus( "3" ); |
74 | inAndOutStock = true; | 84 | inAndOutStock = true; |
75 | } | 85 | } |
76 | if("2".equals( materialINVO.getApproveState() )){ | 86 | if("2".equals( materialINVO.getApproveState() )){ |
77 | materialINVO.setAuditStatus( "2" ); | 87 | materialINTemp.setAuditStatus( "2" ); |
78 | } | 88 | } |
79 | this.baseMapper.updateById( materialINVO ) ; | ||
80 | 89 | ||
81 | //审批记录 | ||
82 | ApproveRecord record = new ApproveRecord( "YJIN", materialINVO.getApplyUser(), materialINVO.getId(), BaseContextHandler.getUserId(), materialINVO.getApproveMessage(), materialINVO.getApproveState()); | ||
83 | recordMapper.insert( record ) ; | ||
84 | 90 | ||
85 | // 审核通过,生成入库单据、物料单 | 91 | // 审核通过,生成入库单据、物料单 |
86 | if(inAndOutStock ){ | 92 | if(inAndOutStock ){ |
87 | try { | 93 | //出库 |
88 | //出库 | 94 | errMsg = syncEquipmentOut(materialINTemp); |
89 | syncEquipmentOut(materialINVO); | 95 | //入库 |
90 | //入库 | 96 | errMsg = syncEquipmentIn(materialINTemp,inWarehouseId); |
91 | syncEquipmentIn(materialINVO,inWarehouseId); | ||
92 | } catch (Exception e) { | ||
93 | e.printStackTrace(); | ||
94 | |||
95 | } | ||
96 | } | 97 | } |
98 | this.baseMapper.updateById( materialINTemp ) ; | ||
99 | |||
100 | //审批记录 | ||
101 | ApproveRecord record = new ApproveRecord( "YJIN", materialINVO.getApplyUser(), materialINVO.getId(), BaseContextHandler.getUserId(), materialINVO.getApproveMessage(), materialINVO.getApproveState()); | ||
102 | recordMapper.insert( record ) ; | ||
97 | 103 | ||
98 | return errMsg; | 104 | return errMsg; |
99 | } | 105 | } |
... | @@ -130,12 +136,55 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia | ... | @@ -130,12 +136,55 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia |
130 | * 出库 | 136 | * 出库 |
131 | * @return | 137 | * @return |
132 | */ | 138 | */ |
133 | public int syncEquipmentOut(MaterialINVO materialINVO){ | 139 | public String syncEquipmentOut(MaterialIN materialINTemp)throws Exception{ |
140 | String errMsg = null; | ||
134 | EquipmentOutDTO equipmentOutDTO = new EquipmentOutDTO(); | 141 | EquipmentOutDTO equipmentOutDTO = new EquipmentOutDTO(); |
135 | 142 | try{ | |
136 | 143 | ||
144 | ERPPurchaseContract erpPurchaseContract = purchaseContractService.getById(materialINTemp.getPurchaseContractId()); | ||
145 | if(erpPurchaseContract != null ){ | ||
146 | if(StringUtils.isNotEmpty(erpPurchaseContract.getEquipmentInId())){ | ||
147 | EquipmentIn equipmentIn = equipmentInService.getById( erpPurchaseContract.getEquipmentInId() ); | ||
148 | equipmentOutDTO.setDepartId( equipmentIn.getDepartId() ) ; | ||
149 | equipmentOutDTO.setOutType("9");// | ||
150 | equipmentOutDTO.setRemark( materialINTemp.getRemark() ); | ||
151 | equipmentOutDTO.setChooseTime(BaseUtil.getCurrentDate());//经办时间 | ||
152 | equipmentOutDTO.setUseBy( BaseContextHandler.getUserId() );//使用人 | ||
153 | equipmentOutDTO.setOutDate( BaseUtil.getCurrentDate() ); | ||
154 | equipmentOutDTO.setInventoryUpdateTimeEnd( BaseUtil.getCurrentDate()); | ||
155 | |||
156 | equipmentOutDTO.setSuppliesWarehouseId( equipmentIn.getSuppliesWarehouseId() );// this.suppliesWarehouseId = suppliesWarehouseId;//所属仓库 | ||
157 | //this.outOrder = outOrder; | ||
158 | // this.recipient = recipient;//领用人 | ||
159 | equipmentOutDTO.setRecipient( materialINTemp.getReceiver());//收货人,领用人 | ||
160 | |||
161 | EquipmentOutChild equipmentOutChild = new EquipmentOutChild(); | ||
162 | equipmentOutChild.setSparepartId(materialINTemp.getSparepartId() );// | ||
163 | equipmentOutChild.setOutNum( new BigDecimal( materialINTemp.getMaterialNum() ) ) ;//出库数量 | ||
164 | equipmentOutChild.setTotalPrice( new BigDecimal( materialINTemp.getDistributTotalPrice() ) );//总价格 | ||
165 | equipmentOutChild.setBatchNum( materialINTemp.getGoodCode() );//批次号 | ||
166 | |||
167 | List<EquipmentOutChild> outChildList = new ArrayList<EquipmentOutChild>(); | ||
168 | outChildList.add( equipmentOutChild ); | ||
169 | equipmentOutDTO.setEquipmentOutChildList( outChildList ); | ||
170 | |||
171 | |||
172 | // 创建出库单 | ||
173 | equipmentOutService.saveEquipmentOut(equipmentOutDTO); | ||
174 | |||
175 | materialINTemp.setEquipmentOutId( equipmentOutDTO.getId()); | ||
176 | }else{ | ||
177 | throw new ServiceException("未找到统购合同的入库信息"); | ||
178 | } | ||
179 | }else{ | ||
180 | throw new ServiceException("统购合同不存在"); | ||
181 | } | ||
182 | }catch(ServiceException e){ | ||
183 | e.printStackTrace(); | ||
184 | throw new ServiceException("入库失败:"+e.getMessage()); | ||
185 | } | ||
137 | //equipmentOutService.saveEquipmentOut(equipmentOutDTO); | 186 | //equipmentOutService.saveEquipmentOut(equipmentOutDTO); |
138 | return 1; | 187 | return errMsg; |
139 | } | 188 | } |
140 | 189 | ||
141 | /*** | 190 | /*** |
... | @@ -143,7 +192,8 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia | ... | @@ -143,7 +192,8 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia |
143 | * @param materialINVO | 192 | * @param materialINVO |
144 | * @return | 193 | * @return |
145 | */ | 194 | */ |
146 | public int syncEquipmentIn(MaterialINVO materialINVO,String inWarehouseId) throws Exception{ | 195 | public String syncEquipmentIn(MaterialIN materialINVO,String inWarehouseId) throws Exception{ |
196 | String errMsg = null; | ||
147 | EquipmentInDTO equipmentInDTO = new EquipmentInDTO(); | 197 | EquipmentInDTO equipmentInDTO = new EquipmentInDTO(); |
148 | // EquipmentIn equipmentIn = new EquipmentIn(); | 198 | // EquipmentIn equipmentIn = new EquipmentIn(); |
149 | //入库类型 | 199 | //入库类型 |
... | @@ -152,7 +202,7 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia | ... | @@ -152,7 +202,7 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia |
152 | 202 | ||
153 | equipmentInDTO.setSuppliesWarehouseId( inWarehouseId ) ;//入库仓库 | 203 | equipmentInDTO.setSuppliesWarehouseId( inWarehouseId ) ;//入库仓库 |
154 | equipmentInDTO.setInDate( DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss")); | 204 | equipmentInDTO.setInDate( DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss")); |
155 | equipmentInDTO.setUseBy( BaseContextHandler.getUserId() ) ;//经办人 | 205 | equipmentInDTO.setUseBy( materialINVO.getReceiver() ) ;//经办人(收货人) |
156 | equipmentInDTO.setChooseTime( DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss") );//经办时间 | 206 | equipmentInDTO.setChooseTime( DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss") );//经办时间 |
157 | equipmentInDTO.setRemark( materialINVO.getRemark() );//备注 | 207 | equipmentInDTO.setRemark( materialINVO.getRemark() );//备注 |
158 | 208 | ||
... | @@ -160,12 +210,12 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia | ... | @@ -160,12 +210,12 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia |
160 | EquipmentInChild equipmentInChild = new EquipmentInChild();// | 210 | EquipmentInChild equipmentInChild = new EquipmentInChild();// |
161 | 211 | ||
162 | equipmentInChild.setSparepartId( materialINVO.getSparepartId());//物料编号 | 212 | equipmentInChild.setSparepartId( materialINVO.getSparepartId());//物料编号 |
213 | |||
163 | equipmentInChild.setInNum( new BigDecimal(materialINVO.getMaterialNum())); //物料数量 | 214 | equipmentInChild.setInNum( new BigDecimal(materialINVO.getMaterialNum())); //物料数量 |
164 | equipmentInChild.setBatchNum(materialINVO.getGoodCode() ) ;//批次号 | 215 | equipmentInChild.setBatchNum(materialINVO.getGoodCode() ) ;//批次号 |
165 | 216 | ||
166 | equipmentInChildrenList.add( equipmentInChild ) ; | 217 | equipmentInChildrenList.add( equipmentInChild ) ; |
167 | 218 | ||
168 | |||
169 | equipmentInDTO.setEquipmentInChildList( equipmentInChildrenList ); | 219 | equipmentInDTO.setEquipmentInChildList( equipmentInChildrenList ); |
170 | //调用接口入库 | 220 | //调用接口入库 |
171 | equipmentInService.saveEquipmentIn(equipmentInDTO ) ; | 221 | equipmentInService.saveEquipmentIn(equipmentInDTO ) ; |
... | @@ -175,9 +225,10 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia | ... | @@ -175,9 +225,10 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia |
175 | if(erpPurchaseContract == null ){ | 225 | if(erpPurchaseContract == null ){ |
176 | throw new Exception("采购合同记录不存在"); | 226 | throw new Exception("采购合同记录不存在"); |
177 | }*/ | 227 | }*/ |
178 | materialINVO.setEquipmentInId( equipmentInDTO.getId() ) ;//记录入库单号 | 228 | materialINVO.setEquipmentInId( equipmentInDTO.getId() ) ;//记录入库编号 |
229 | materialINVO.setInOrder( equipmentInDTO.getInOrder() ) ;// 入库单号 | ||
179 | log.debug("记录入库单号{"+equipmentInDTO.getId()+"},入库单号:"+equipmentInDTO.getInOrder()); | 230 | log.debug("记录入库单号{"+equipmentInDTO.getId()+"},入库单号:"+equipmentInDTO.getInOrder()); |
180 | this.baseMapper.updateById(materialINVO ) ; | 231 | |
181 | return 1; | 232 | return errMsg; |
182 | } | 233 | } |
183 | } | 234 | } | ... | ... |
... | @@ -310,4 +310,41 @@ public class DateUtil { | ... | @@ -310,4 +310,41 @@ public class DateUtil { |
310 | } | 310 | } |
311 | return date; | 311 | return date; |
312 | } | 312 | } |
313 | |||
314 | |||
315 | /** | ||
316 | * 格式化 | ||
317 | * @param date | ||
318 | * @param format | ||
319 | * @return | ||
320 | */ | ||
321 | public static String dateformat(String date, String format) { | ||
322 | SimpleDateFormat sformat = new SimpleDateFormat(format); | ||
323 | Date _date = null; | ||
324 | try { | ||
325 | _date = sformat.parse(date); | ||
326 | } catch (ParseException var5) { | ||
327 | var5.printStackTrace(); | ||
328 | } | ||
329 | return sformat.format(_date); | ||
330 | } | ||
331 | |||
332 | /*** | ||
333 | * 两个时间差 | ||
334 | * @param date1 | ||
335 | * @param date2 | ||
336 | * @return | ||
337 | */ | ||
338 | public static int differenceTime(String date1,String date2){ | ||
339 | int daysDifference = 1; | ||
340 | try{ | ||
341 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
342 | // 计算两个日期之间的差值 | ||
343 | daysDifference = org.apache.commons.lang3.time.DateUtils.toCalendar( sdf.parse(date2)).get(Calendar.DAY_OF_YEAR) | ||
344 | - org.apache.commons.lang3.time.DateUtils.toCalendar( sdf.parse(date1)).get(Calendar.DAY_OF_YEAR); // 直接计算天数差值 | ||
345 | }catch(Exception e){ | ||
346 | e.printStackTrace(); | ||
347 | } | ||
348 | return daysDifference; | ||
349 | } | ||
313 | } | 350 | } | ... | ... |
... | @@ -14,6 +14,17 @@ import java.util.regex.Matcher; | ... | @@ -14,6 +14,17 @@ import java.util.regex.Matcher; |
14 | import java.util.regex.Pattern; | 14 | import java.util.regex.Pattern; |
15 | 15 | ||
16 | public class BaseUtil { | 16 | public class BaseUtil { |
17 | |||
18 | public static String dateformat(String date, String format) { | ||
19 | SimpleDateFormat sformat = new SimpleDateFormat(format); | ||
20 | Date _date = null; | ||
21 | try { | ||
22 | _date = sformat.parse(date); | ||
23 | } catch (ParseException var5) { | ||
24 | var5.printStackTrace(); | ||
25 | } | ||
26 | return sformat.format(_date); | ||
27 | } | ||
17 | /** | 28 | /** |
18 | * 保留两位小数方法 | 29 | * 保留两位小数方法 |
19 | * | 30 | * |
... | @@ -419,6 +430,8 @@ public class BaseUtil { | ... | @@ -419,6 +430,8 @@ public class BaseUtil { |
419 | return calendar.get(Calendar.SECOND); | 430 | return calendar.get(Calendar.SECOND); |
420 | } | 431 | } |
421 | 432 | ||
433 | |||
434 | |||
422 | /** | 435 | /** |
423 | * 过滤html标签 | 436 | * 过滤html标签 |
424 | * @param htmlStr | 437 | * @param htmlStr | ... | ... |
... | @@ -23,12 +23,12 @@ public class JTDisplayScreenController { | ... | @@ -23,12 +23,12 @@ public class JTDisplayScreenController { |
23 | @Autowired | 23 | @Autowired |
24 | private IJTDisplayScreenService displayScreenService ; | 24 | private IJTDisplayScreenService displayScreenService ; |
25 | 25 | ||
26 | @AutoLog(value = "厂站记录") | 26 | @AutoLog(value = "厂站地图列表") |
27 | @ApiOperation(value = "厂长列表", notes = "厂长列表") | 27 | @ApiOperation(value = "厂长地图列表", notes = "厂长地图列表") |
28 | @GetMapping(value = "/factoryList") | 28 | @GetMapping(value = "/factoryList") |
29 | public Result<List<SysFactoryInfoVO>> factoryList(String time) { | 29 | public Result<List<SysFactoryInfoVO>> factoryList() { |
30 | Result<List<SysFactoryInfoVO>> result = new Result<>(); | 30 | Result<List<SysFactoryInfoVO>> result = new Result<>(); |
31 | List<SysFactoryInfoVO> list = displayScreenService.getFactoryList(time); | 31 | List<SysFactoryInfoVO> list = displayScreenService.getFactoryList(); |
32 | result.setResult(list); | 32 | result.setResult(list); |
33 | return result; | 33 | return result; |
34 | } | 34 | } | ... | ... |
1 | package com.skua.modules.threedimensional.service; | 1 | package com.skua.modules.threedimensional.service; |
2 | 2 | ||
3 | import com.skua.modules.threedimensional.vo.ProjectOperationInfoVO; | ||
3 | import com.skua.modules.threedimensional.vo.SysFactoryInfoVO; | 4 | import com.skua.modules.threedimensional.vo.SysFactoryInfoVO; |
4 | import java.util.List; | 5 | import java.util.List; |
5 | 6 | ||
7 | /** | ||
8 | * 对外展示集团大屏 | ||
9 | */ | ||
6 | public interface IJTDisplayScreenService { | 10 | public interface IJTDisplayScreenService { |
7 | 11 | ||
8 | /*** | 12 | /*** |
9 | * 厂站列表 | 13 | * 厂站列表 以及出水量统计 |
10 | * @param time | ||
11 | * @return | 14 | * @return |
12 | */ | 15 | */ |
13 | List<SysFactoryInfoVO> getFactoryList(String time ); | 16 | List<SysFactoryInfoVO> getFactoryList( ); |
17 | |||
18 | /** | ||
19 | *对外展示集团大屏 : 项目运营情况 | ||
20 | * @return | ||
21 | */ | ||
22 | ProjectOperationInfoVO getProjectOperationInfo(); | ||
14 | } | 23 | } | ... | ... |
... | @@ -2,13 +2,25 @@ package com.skua.modules.threedimensional.service.impl; | ... | @@ -2,13 +2,25 @@ package com.skua.modules.threedimensional.service.impl; |
2 | 2 | ||
3 | import com.skua.common.report.ReportViewUtil; | 3 | import com.skua.common.report.ReportViewUtil; |
4 | import com.skua.core.context.SpringContextUtils; | 4 | import com.skua.core.context.SpringContextUtils; |
5 | import com.skua.core.util.ConvertUtils; | ||
5 | import com.skua.core.util.DateUtils; | 6 | import com.skua.core.util.DateUtils; |
7 | import com.skua.modules.common.mapper.CommonSqlMapper; | ||
8 | import com.skua.modules.common.service.ICommonSqlService; | ||
9 | import com.skua.modules.common.vo.DateVO; | ||
10 | import com.skua.modules.guest.util.DateUtil; | ||
6 | import com.skua.modules.threedimensional.service.IJTDisplayScreenService; | 11 | import com.skua.modules.threedimensional.service.IJTDisplayScreenService; |
12 | import com.skua.modules.threedimensional.vo.ProjectOperationInfoVO; | ||
7 | import com.skua.modules.threedimensional.vo.SysFactoryInfoVO; | 13 | import com.skua.modules.threedimensional.vo.SysFactoryInfoVO; |
14 | import com.skua.tool.util.DigitalUtils; | ||
15 | import io.swagger.annotations.ApiModelProperty; | ||
16 | import org.springframework.beans.factory.annotation.Autowired; | ||
8 | import org.springframework.jdbc.core.JdbcTemplate; | 17 | import org.springframework.jdbc.core.JdbcTemplate; |
9 | import org.springframework.stereotype.Service; | 18 | import org.springframework.stereotype.Service; |
10 | 19 | ||
20 | import java.util.ArrayList; | ||
21 | import java.util.HashMap; | ||
11 | import java.util.List; | 22 | import java.util.List; |
23 | import java.util.Map; | ||
12 | 24 | ||
13 | 25 | ||
14 | /** | 26 | /** |
... | @@ -16,32 +28,83 @@ import java.util.List; | ... | @@ -16,32 +28,83 @@ import java.util.List; |
16 | */ | 28 | */ |
17 | @Service | 29 | @Service |
18 | public class JTDisplayScreenServiceImpl implements IJTDisplayScreenService { | 30 | public class JTDisplayScreenServiceImpl implements IJTDisplayScreenService { |
31 | |||
32 | @Autowired | ||
33 | private ICommonSqlService commonSqlService; | ||
34 | |||
19 | private static String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1"; | 35 | private static String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1"; |
20 | /*** | 36 | /*** |
21 | * | 37 | *厂站列表 以及出水量统计 |
22 | * @return | 38 | * @return |
23 | */ | 39 | */ |
24 | public List<SysFactoryInfoVO> getFactoryList(String time ){ | 40 | public List<SysFactoryInfoVO> getFactoryList( ){ |
25 | List<SysFactoryInfoVO> factoryInfoVOList = null; | 41 | List<SysFactoryInfoVO> factoryInfoVOList = null; |
26 | String startDate = time+"-01"; | 42 | Map<String, SysFactoryInfoVO> factoryInfoMap = new HashMap<>(); |
27 | String endDate = time+"-31";; | 43 | SysFactoryInfoVO factoryInfoVO = null; |
28 | String departId = null; | ||
29 | 44 | ||
30 | String yesterday = DateUtils.getYesterday(); | 45 | String lastDay = DateUtils.getLastDay();//昨天 |
46 | String currentDate = DateUtil.getCurrentDate();//今天 | ||
47 | DateVO dateVO = new DateVO( DateUtil.getCurrentDate() ); | ||
48 | //时间差 | ||
49 | int differenceTime = DateUtil.differenceTime( dateVO.getNowYearStartDate(),currentDate); | ||
50 | //主库数据源 | ||
51 | JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master"); | ||
31 | 52 | ||
32 | // | 53 | String factorySql = "select fi.id,fi.depart_id,d.depart_name, fi.pro_longitude,fi.pro_latitude from sys_factory_info fi ,sys_depart d where fi.depart_id = d.id and d.depart_type =1"; |
54 | List<Map<String, Object>> dataList = masterDB.queryForList(factorySql); | ||
55 | for(Map<String, Object> dataMap : dataList) { | ||
56 | // resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("create_by"))+""+ConvertUtils.getString(dataMap.get("title"))); | ||
57 | factoryInfoVO = new SysFactoryInfoVO(dataMap.get("id")+"",dataMap.get("depart_id").toString(),dataMap.get("depart_name").toString(),dataMap.get("pro_longitude").toString(),dataMap.get("pro_latitude").toString()); | ||
58 | factoryInfoMap.put(factoryInfoVO.getDepartId(),factoryInfoVO); | ||
59 | } | ||
60 | //查询部门集合 | ||
33 | String departIdSql ="select GROUP_CONCAT(fi.depart_id ) from sys_factory_info fi ,sys_depart d where fi.depart_id = d.id and d.depart_type =1 "; | 61 | String departIdSql ="select GROUP_CONCAT(fi.depart_id ) from sys_factory_info fi ,sys_depart d where fi.depart_id = d.id and d.depart_type =1 "; |
34 | String departIds = null; | 62 | String departIds = masterDB.queryForObject( departIdSql,String.class); |
35 | String dataViewName2119 = ReportViewUtil.buildViewLike(view2119,"CSL", departIds, startDate, endDate); | ||
36 | System.out.println("********************************************"); | ||
37 | System.out.println(dataViewName2119); | ||
38 | 63 | ||
39 | //主库数据源 | 64 | //昨天处理水量(m³) |
40 | JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master"); | 65 | String dataViewName2119 = ReportViewUtil.buildViewLike(view2119,"CSL", departIds, lastDay, lastDay);//depart_id CSL |
66 | dataList = masterDB.queryForList(dataViewName2119); | ||
67 | for(Map<String, Object> dataMap : dataList) { | ||
68 | factoryInfoVO = factoryInfoMap.get(dataMap.get("depart_id").toString()); | ||
69 | if(factoryInfoVO != null ) factoryInfoVO.setCsl_lastDay(dataMap.get("CSL").toString() ) ; | ||
70 | // resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("create_by"))+""+ConvertUtils.getString(dataMap.get("title"))); | ||
71 | } | ||
72 | //本月处理水量(m³) | ||
73 | dataViewName2119 = ReportViewUtil.buildViewLike(view2119,"CSL", departIds, dateVO.getNowMonthStartDate(), dateVO.getNowMonthEndDate()); | ||
74 | dataList = masterDB.queryForList(dataViewName2119); | ||
75 | for(Map<String, Object> dataMap : dataList) { | ||
76 | factoryInfoVO = factoryInfoMap.get(dataMap.get("depart_id").toString()); | ||
77 | if(factoryInfoVO != null ) factoryInfoVO.setCsl_month(dataMap.get("CSL").toString() ) ; | ||
78 | // resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("create_by"))+""+ConvertUtils.getString(dataMap.get("title"))); | ||
79 | } | ||
80 | //本年处理水量(万m³) | ||
81 | dataViewName2119 = ReportViewUtil.buildViewLike(view2119,"CSL", departIds, dateVO.getNowYearStartDate(), currentDate); | ||
82 | dataList = masterDB.queryForList(dataViewName2119); | ||
83 | for(Map<String, Object> dataMap : dataList) { | ||
84 | factoryInfoVO = factoryInfoMap.get(dataMap.get("depart_id").toString()); | ||
85 | if(factoryInfoVO != null ){ | ||
86 | factoryInfoVO.setCsl_year(dataMap.get("CSL").toString() ) ; | ||
87 | factoryInfoVO.setCsl_avg_day(DigitalUtils.division( dataMap.get("CSL").toString() ,differenceTime+"" ) ); | ||
88 | } | ||
89 | // resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("create_by"))+""+ConvertUtils.getString(dataMap.get("title"))); | ||
90 | } | ||
91 | factoryInfoVOList = new ArrayList(factoryInfoMap.values()); | ||
92 | return factoryInfoVOList; | ||
93 | } | ||
41 | 94 | ||
42 | String sql = "select " + " sum(v1.CSL)/10000 " + " from "+dataViewName2119+" v1 " ; | ||
43 | 95 | ||
96 | /** | ||
97 | *对外展示集团大屏 : 项目运营情况 | ||
98 | * @return | ||
99 | */ | ||
100 | public ProjectOperationInfoVO getProjectOperationInfo(){ | ||
101 | ProjectOperationInfoVO projectOperationInfoVO = new ProjectOperationInfoVO(); | ||
44 | 102 | ||
45 | return factoryInfoVOList; | 103 | |
104 | |||
105 | |||
106 | |||
107 | return projectOperationInfoVO; | ||
46 | } | 108 | } |
109 | |||
47 | } | 110 | } | ... | ... |
sk-module-biz/src/main/java/com/skua/modules/threedimensional/vo/ProjectOperationInfoVO.java
0 → 100644
1 | package com.skua.modules.threedimensional.vo; | ||
2 | |||
3 | import io.swagger.annotations.ApiModel; | ||
4 | import io.swagger.annotations.ApiModelProperty; | ||
5 | import lombok.Data; | ||
6 | |||
7 | /** | ||
8 | * 对外展示集团大屏 | ||
9 | */ | ||
10 | @Data | ||
11 | @ApiModel(value="对外展示集团大屏:项目运营情况", description="对外展示集团大屏:项目运营情况") | ||
12 | public class ProjectOperationInfoVO { | ||
13 | @ApiModelProperty(value = "水厂数") | ||
14 | private String departCount; | ||
15 | |||
16 | @ApiModelProperty(value = "污水处理能力") | ||
17 | private String wsclnl; | ||
18 | |||
19 | @ApiModelProperty(value = "月产水量") | ||
20 | private String ycsl; | ||
21 | |||
22 | @ApiModelProperty(value = "水质综合达标率") | ||
23 | private String szzhdbl; | ||
24 | |||
25 | @ApiModelProperty(value = "运行负荷率") | ||
26 | private String yxfhl; | ||
27 | |||
28 | @ApiModelProperty(value = "污泥含水率") | ||
29 | private String wnhsl; | ||
30 | } |
... | @@ -15,6 +15,9 @@ public class SysFactoryInfoVO { | ... | @@ -15,6 +15,9 @@ public class SysFactoryInfoVO { |
15 | private String id; | 15 | private String id; |
16 | 16 | ||
17 | @ApiModelProperty(value = "水厂名称") | 17 | @ApiModelProperty(value = "水厂名称") |
18 | private String departId; | ||
19 | |||
20 | @ApiModelProperty(value = "水厂名称") | ||
18 | private String departName; | 21 | private String departName; |
19 | 22 | ||
20 | @ApiModelProperty(value = "经度") | 23 | @ApiModelProperty(value = "经度") |
... | @@ -35,4 +38,15 @@ public class SysFactoryInfoVO { | ... | @@ -35,4 +38,15 @@ public class SysFactoryInfoVO { |
35 | @ApiModelProperty(value = "本年处理水量") | 38 | @ApiModelProperty(value = "本年处理水量") |
36 | private String csl_year; | 39 | private String csl_year; |
37 | 40 | ||
41 | |||
42 | public SysFactoryInfoVO() { | ||
43 | } | ||
44 | |||
45 | public SysFactoryInfoVO(String id, String departId, String departName, String proLongitude, String proLatitude) { | ||
46 | this.id = id; | ||
47 | this.departId = departId; | ||
48 | this.departName = departName; | ||
49 | this.proLongitude = proLongitude; | ||
50 | this.proLatitude = proLatitude; | ||
51 | } | ||
38 | } | 52 | } | ... | ... |
... | @@ -48,7 +48,7 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService { | ... | @@ -48,7 +48,7 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService { |
48 | List<WaterQualityMonitoringDetailVO> list = new ArrayList<>(); | 48 | List<WaterQualityMonitoringDetailVO> list = new ArrayList<>(); |
49 | Map<String, Object> monitorTagMap = new HashMap<String,Object>(); | 49 | Map<String, Object> monitorTagMap = new HashMap<String,Object>(); |
50 | QueryWrapper<SysMonitorMetricInfo> qw = new QueryWrapper<>(); | 50 | QueryWrapper<SysMonitorMetricInfo> qw = new QueryWrapper<>(); |
51 | qw.in("metric_uid_tag", "JSTP,JSTN,JSPH,JSNH3N,JSCOD,CSTP,CSTN,CSPH,CSNH3N,CSCOD".split(",")); | 51 | qw.in("metric_uid_tag", "JSTP,JSTN,JSPH,JSNH3N,JSCOD,CSTP,CSTN,CSPH,CSNH3N,CSCOD".split(",")); //CSLL 出水瞬时流量() CSLJLL出水流量累计JSLL(JSLJLL) JSSS 进水浊度 CSSS 出水浊度 |
52 | qw.eq("depart_id", departId); | 52 | qw.eq("depart_id", departId); |
53 | qw.groupBy("depart_id","metric_uid_tag"); | 53 | qw.groupBy("depart_id","metric_uid_tag"); |
54 | List<SysMonitorMetricInfo> monitorList = sysMonitorMetricInfoService.list(qw); | 54 | List<SysMonitorMetricInfo> monitorList = sysMonitorMetricInfoService.list(qw); | ... | ... |
... | @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType; | ... | @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType; |
4 | import com.baomidou.mybatisplus.annotation.TableId; | 4 | import com.baomidou.mybatisplus.annotation.TableId; |
5 | import com.baomidou.mybatisplus.annotation.TableName; | 5 | import com.baomidou.mybatisplus.annotation.TableName; |
6 | import com.fasterxml.jackson.annotation.JsonFormat; | 6 | import com.fasterxml.jackson.annotation.JsonFormat; |
7 | import com.skua.core.aspect.annotation.Dict; | ||
7 | import io.swagger.annotations.ApiModel; | 8 | import io.swagger.annotations.ApiModel; |
8 | import io.swagger.annotations.ApiModelProperty; | 9 | import io.swagger.annotations.ApiModelProperty; |
9 | import lombok.Data; | 10 | import lombok.Data; |
... | @@ -42,6 +43,7 @@ public class EquipmentInChild { | ... | @@ -42,6 +43,7 @@ public class EquipmentInChild { |
42 | */ | 43 | */ |
43 | @Excel(name = "备品备件id", width = 15) | 44 | @Excel(name = "备品备件id", width = 15) |
44 | @ApiModelProperty(value = "备品备件id") | 45 | @ApiModelProperty(value = "备品备件id") |
46 | @Dict(dictTable = "equipment_sparepart_supplies", dicCode="id", dicText = "sparepart_name") | ||
45 | private String sparepartId; | 47 | private String sparepartId; |
46 | /** | 48 | /** |
47 | * 入库数量 | 49 | * 入库数量 |
... | @@ -117,4 +119,4 @@ public class EquipmentInChild { | ... | @@ -117,4 +119,4 @@ public class EquipmentInChild { |
117 | /**税率*/ | 119 | /**税率*/ |
118 | private BigDecimal taxRate; | 120 | private BigDecimal taxRate; |
119 | 121 | ||
120 | } | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
122 | } | ... | ... |
... | @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType; | ... | @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType; |
4 | import com.baomidou.mybatisplus.annotation.TableId; | 4 | import com.baomidou.mybatisplus.annotation.TableId; |
5 | import com.baomidou.mybatisplus.annotation.TableName; | 5 | import com.baomidou.mybatisplus.annotation.TableName; |
6 | import com.fasterxml.jackson.annotation.JsonFormat; | 6 | import com.fasterxml.jackson.annotation.JsonFormat; |
7 | import com.skua.core.aspect.annotation.Dict; | ||
7 | import io.swagger.annotations.ApiModel; | 8 | import io.swagger.annotations.ApiModel; |
8 | import io.swagger.annotations.ApiModelProperty; | 9 | import io.swagger.annotations.ApiModelProperty; |
9 | import lombok.Data; | 10 | import lombok.Data; |
... | @@ -42,6 +43,7 @@ public class EquipmentOutChild { | ... | @@ -42,6 +43,7 @@ public class EquipmentOutChild { |
42 | */ | 43 | */ |
43 | @Excel(name = "备品备件id", width = 15) | 44 | @Excel(name = "备品备件id", width = 15) |
44 | @ApiModelProperty(value = "备品备件id") | 45 | @ApiModelProperty(value = "备品备件id") |
46 | @Dict(dictTable = "equipment_sparepart_supplies", dicCode="id", dicText = "sparepart_name") | ||
45 | private String sparepartId; | 47 | private String sparepartId; |
46 | /** | 48 | /** |
47 | * 出库数量 | 49 | * 出库数量 | ... | ... |
... | @@ -77,7 +77,6 @@ public class EquipmentInServiceImpl extends ServiceImpl<EquipmentInMapper, Equip | ... | @@ -77,7 +77,6 @@ public class EquipmentInServiceImpl extends ServiceImpl<EquipmentInMapper, Equip |
77 | public int saveEquipmentIn(EquipmentInDTO equipmentInDTO) throws Exception { | 77 | public int saveEquipmentIn(EquipmentInDTO equipmentInDTO) throws Exception { |
78 | List<SuppliesWarehouse> suppliesWarehouseList = suppliesWarehouseService.list();//供应商列表 | 78 | List<SuppliesWarehouse> suppliesWarehouseList = suppliesWarehouseService.list();//供应商列表 |
79 | Map<String, String> warehouseDictMap = suppliesWarehouseList.stream().collect(Collectors.toMap(SuppliesWarehouse::getId, SuppliesWarehouse::getDepartId)); | 79 | Map<String, String> warehouseDictMap = suppliesWarehouseList.stream().collect(Collectors.toMap(SuppliesWarehouse::getId, SuppliesWarehouse::getDepartId)); |
80 | |||
81 | if (equipmentInDTO.getEquipmentInChildList() == null || equipmentInDTO.getEquipmentInChildList().isEmpty()) { | 80 | if (equipmentInDTO.getEquipmentInChildList() == null || equipmentInDTO.getEquipmentInChildList().isEmpty()) { |
82 | throw new JeecgBootException("请选择入库备件!"); | 81 | throw new JeecgBootException("请选择入库备件!"); |
83 | } | 82 | } |
... | @@ -102,7 +101,7 @@ public class EquipmentInServiceImpl extends ServiceImpl<EquipmentInMapper, Equip | ... | @@ -102,7 +101,7 @@ public class EquipmentInServiceImpl extends ServiceImpl<EquipmentInMapper, Equip |
102 | this.baseMapper.insert(equipmentIn); | 101 | this.baseMapper.insert(equipmentIn); |
103 | return 1; | 102 | return 1; |
104 | })); | 103 | })); |
105 | CountDownLatch countDownLatch = new CountDownLatch(equipmentInDTO.getEquipmentInChildList().size()); | 104 | // CountDownLatch countDownLatch = new CountDownLatch(equipmentInDTO.getEquipmentInChildList().size()); |
106 | /* //如果是采购入库 | 105 | /* //如果是采购入库 |
107 | Map<String, PurchaseInfoDetail> purchaseMap = Maps.newHashMap(); | 106 | Map<String, PurchaseInfoDetail> purchaseMap = Maps.newHashMap(); |
108 | if ("cg".equals(equipmentInDTO.getInType()) && StringUtils.isNotEmpty(equipmentInDTO.getPurchaseCode())) { | 107 | if ("cg".equals(equipmentInDTO.getInType()) && StringUtils.isNotEmpty(equipmentInDTO.getPurchaseCode())) { |
... | @@ -115,8 +114,7 @@ public class EquipmentInServiceImpl extends ServiceImpl<EquipmentInMapper, Equip | ... | @@ -115,8 +114,7 @@ public class EquipmentInServiceImpl extends ServiceImpl<EquipmentInMapper, Equip |
115 | }*/ | 114 | }*/ |
116 | for (EquipmentInChild equipmentInChild : equipmentInDTO.getEquipmentInChildList()) { | 115 | for (EquipmentInChild equipmentInChild : equipmentInDTO.getEquipmentInChildList()) { |
117 | equipmentInChild.setInId(inId); | 116 | equipmentInChild.setInId(inId); |
118 | taskExecutor.execute(() -> { | 117 | // taskExecutor.execute(() -> { |
119 | try { | ||
120 | String sparepartId = equipmentInChild.getSparepartId(); | 118 | String sparepartId = equipmentInChild.getSparepartId(); |
121 | String suppliesWarehouseId = equipmentInDTO.getSuppliesWarehouseId(); | 119 | String suppliesWarehouseId = equipmentInDTO.getSuppliesWarehouseId(); |
122 | //根据物资id和仓库id获取库存 | 120 | //根据物资id和仓库id获取库存 |
... | @@ -167,15 +165,10 @@ public class EquipmentInServiceImpl extends ServiceImpl<EquipmentInMapper, Equip | ... | @@ -167,15 +165,10 @@ public class EquipmentInServiceImpl extends ServiceImpl<EquipmentInMapper, Equip |
167 | //============= | 165 | //============= |
168 | return 1; | 166 | return 1; |
169 | }); | 167 | }); |
170 | } catch (Exception e1) { | 168 | |
171 | e1.printStackTrace(); | 169 | // }); |
172 | // log.error("异常error: {}", e1.getMessage()); | ||
173 | } finally { | ||
174 | countDownLatch.countDown(); | ||
175 | } | ||
176 | }); | ||
177 | } | 170 | } |
178 | countDownLatch.await(); | 171 | //countDownLatch.await(); |
179 | return 1; | 172 | return 1; |
180 | } | 173 | } |
181 | 174 | ... | ... |
... | @@ -20,9 +20,8 @@ import com.skua.tool.util.UniqIdUtils; | ... | @@ -20,9 +20,8 @@ import com.skua.tool.util.UniqIdUtils; |
20 | import org.apache.commons.lang.StringUtils; | 20 | import org.apache.commons.lang.StringUtils; |
21 | import org.springframework.beans.BeanUtils; | 21 | import org.springframework.beans.BeanUtils; |
22 | import org.springframework.beans.factory.annotation.Autowired; | 22 | import org.springframework.beans.factory.annotation.Autowired; |
23 | import org.springframework.beans.factory.annotation.Qualifier; | ||
24 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | ||
25 | import org.springframework.stereotype.Service; | 23 | import org.springframework.stereotype.Service; |
24 | import org.springframework.transaction.annotation.Transactional; | ||
26 | import org.springframework.transaction.support.TransactionTemplate; | 25 | import org.springframework.transaction.support.TransactionTemplate; |
27 | 26 | ||
28 | import javax.annotation.Resource; | 27 | import javax.annotation.Resource; |
... | @@ -37,10 +36,6 @@ import java.util.concurrent.CountDownLatch; | ... | @@ -37,10 +36,6 @@ import java.util.concurrent.CountDownLatch; |
37 | */ | 36 | */ |
38 | @Service | 37 | @Service |
39 | public class EquipmentOutServiceImpl extends ServiceImpl<EquipmentOutMapper, EquipmentOut> implements IEquipmentOutService { | 38 | public class EquipmentOutServiceImpl extends ServiceImpl<EquipmentOutMapper, EquipmentOut> implements IEquipmentOutService { |
40 | |||
41 | @Autowired | ||
42 | @Qualifier("taskExecutor") | ||
43 | private ThreadPoolTaskExecutor taskExecutor; | ||
44 | @Resource | 39 | @Resource |
45 | private EquipmentOutMapper equipmentOutMapper; | 40 | private EquipmentOutMapper equipmentOutMapper; |
46 | 41 | ||
... | @@ -63,78 +58,78 @@ public class EquipmentOutServiceImpl extends ServiceImpl<EquipmentOutMapper, Equ | ... | @@ -63,78 +58,78 @@ public class EquipmentOutServiceImpl extends ServiceImpl<EquipmentOutMapper, Equ |
63 | * @param equipmentOutDTO | 58 | * @param equipmentOutDTO |
64 | * @return | 59 | * @return |
65 | */ | 60 | */ |
61 | @Transactional | ||
66 | public String saveEquipmentOut(EquipmentOutDTO equipmentOutDTO) throws Exception { | 62 | public String saveEquipmentOut(EquipmentOutDTO equipmentOutDTO) throws Exception { |
67 | String errMsg = null; | 63 | String errMsg = null; |
68 | if (equipmentOutDTO.getEquipmentOutChildList() == null || equipmentOutDTO.getEquipmentOutChildList().isEmpty()) { | 64 | try{ |
69 | errMsg = "请选择出库备件"; | 65 | if (equipmentOutDTO.getEquipmentOutChildList() == null || equipmentOutDTO.getEquipmentOutChildList().isEmpty()) { |
70 | return errMsg; | 66 | errMsg = "请选择出库备件"; |
71 | } | 67 | return errMsg; |
72 | // 出库单号 | 68 | } |
73 | if (StringUtils.isEmpty(equipmentOutDTO.getOutOrder())) { | 69 | // 出库单号 |
74 | String outOrder = "CK-" + DateUtils.format(new Date(), "YYYYMMdd" + "-" + System.currentTimeMillis()); | 70 | if (StringUtils.isEmpty(equipmentOutDTO.getOutOrder())) { |
75 | equipmentOutDTO.setOutOrder(outOrder); | 71 | String outOrder = "CK-" + DateUtils.format(new Date(), "YYYYMMdd" + "-" + System.currentTimeMillis()); |
76 | } | 72 | equipmentOutDTO.setOutOrder(outOrder); |
77 | // 出库表主键 | 73 | } |
78 | String outId = UUID.randomUUID().toString().replaceAll("-", ""); | 74 | // 出库表主键 |
79 | equipmentOutDTO.setId(outId); | 75 | String outId = UUID.randomUUID().toString().replaceAll("-", ""); |
80 | EquipmentOut equipmentOut = BeanExtUtils.bean2Bean(equipmentOutDTO, EquipmentOut.class); | 76 | equipmentOutDTO.setId(outId); |
81 | equipmentOut.setInventoryUpdateTime(new Date()); | 77 | EquipmentOut equipmentOut = BeanExtUtils.bean2Bean(equipmentOutDTO, EquipmentOut.class); |
82 | this.baseMapper.insert(equipmentOut); | 78 | equipmentOut.setInventoryUpdateTime(new Date()); |
83 | CountDownLatch countDownLatch = new CountDownLatch(equipmentOutDTO.getEquipmentOutChildList().size()); | 79 | this.baseMapper.insert(equipmentOut); |
84 | for (EquipmentOutChild equipmentOutChild : equipmentOutDTO.getEquipmentOutChildList()) { | 80 | // CountDownLatch countDownLatch = new CountDownLatch(equipmentOutDTO.getEquipmentOutChildList().size()); |
85 | equipmentOutChild.setId(UniqIdUtils.getInstance().getUniqID()); | 81 | for (EquipmentOutChild equipmentOutChild : equipmentOutDTO.getEquipmentOutChildList()) { |
86 | equipmentOutChild.setOutId(outId); | 82 | equipmentOutChild.setId(UniqIdUtils.getInstance().getUniqID()); |
87 | taskExecutor.execute(() -> { | 83 | equipmentOutChild.setOutId(outId); |
88 | try { | 84 | // taskExecutor.execute(() -> { |
89 | String sparepartId = equipmentOutChild.getSparepartId(); | 85 | String sparepartId = equipmentOutChild.getSparepartId(); |
90 | String suppliesWarehouseId = equipmentOutDTO.getSuppliesWarehouseId(); | 86 | String suppliesWarehouseId = equipmentOutDTO.getSuppliesWarehouseId(); |
91 | 87 | ||
92 | //根据物资id和仓库id获取库存 | 88 | //根据物资id和仓库id获取库存 |
93 | QueryWrapper<EquipmentSparepart> sparepartQueryWrapper = new QueryWrapper<>(); | 89 | QueryWrapper<EquipmentSparepart> sparepartQueryWrapper = new QueryWrapper<>(); |
94 | sparepartQueryWrapper.eq("supplies_id", sparepartId).eq("supplies_warehouse_id", suppliesWarehouseId); | 90 | sparepartQueryWrapper.eq("supplies_id", sparepartId).eq("supplies_warehouse_id", suppliesWarehouseId); |
95 | EquipmentSparepart equipmentSparepart = iEquipmentSparepartService.getOne(sparepartQueryWrapper); | 91 | EquipmentSparepart equipmentSparepart = iEquipmentSparepartService.getOne(sparepartQueryWrapper); |
96 | if (ObjectUtil.isEmpty(equipmentSparepart)) { | 92 | if (ObjectUtil.isEmpty(equipmentSparepart)) { |
97 | //物料信息 | 93 | //物料信息 |
98 | EquipmentSparepartSupplies supplies = sparepartSuppliesService.getById(sparepartId); | 94 | EquipmentSparepartSupplies supplies = sparepartSuppliesService.getById(sparepartId); |
99 | equipmentSparepart = new EquipmentSparepart(); | 95 | equipmentSparepart = new EquipmentSparepart(); |
96 | if(supplies != null ){ | ||
100 | BeanUtils.copyProperties(supplies, equipmentSparepart); | 97 | BeanUtils.copyProperties(supplies, equipmentSparepart); |
101 | equipmentSparepart.setId(null); | ||
102 | equipmentSparepart.setStorageNum(BigDecimal.ZERO); | ||
103 | equipmentSparepart.setSuppliesId(sparepartId); | ||
104 | equipmentSparepart.setSuppliesWarehouseId(suppliesWarehouseId); | ||
105 | //如果没有物料库存信息,新增库存信息为0 | ||
106 | iEquipmentSparepartService.saveOrUpdate(equipmentSparepart); | ||
107 | equipmentSparepart = iEquipmentSparepartService.getOne(sparepartQueryWrapper); | ||
108 | |||
109 | } | 98 | } |
110 | BigDecimal resetStorageNum = equipmentSparepart.getStorageNum().subtract(equipmentOutChild.getOutNum()); | ||
111 | if (resetStorageNum.doubleValue() < 0) { | ||
112 | return; | ||
113 | } | ||
114 | Integer version = equipmentSparepart.getVersion(); | ||
115 | String id = equipmentSparepart.getId(); | ||
116 | Integer executeRes = transactionTemplate.execute(transactionStatus -> { | ||
117 | int val0 = iEquipmentSparepartService.updateStorageNumById(id, resetStorageNum.doubleValue(), version); | ||
118 | if (val0 == 1 && iEquipmentOutChildService.saveOrUpdate(equipmentOutChild)) { | ||
119 | return 1; | ||
120 | } else { | ||
121 | transactionStatus.setRollbackOnly(); | ||
122 | return 0; | ||
123 | } | ||
124 | }); | ||
125 | // if (executeRes != null && executeRes == 1) { | ||
126 | // | ||
127 | // } | ||
128 | 99 | ||
129 | } catch (Exception e) { | 100 | equipmentSparepart.setId(null); |
130 | e.printStackTrace(); | 101 | equipmentSparepart.setStorageNum(BigDecimal.ZERO); |
131 | //log.error("异常error: {}", e.getMessage()); | 102 | equipmentSparepart.setSuppliesId(sparepartId); |
132 | } finally { | 103 | equipmentSparepart.setSuppliesWarehouseId(suppliesWarehouseId); |
133 | countDownLatch.countDown(); | 104 | //如果没有物料库存信息,新增库存信息为0 |
105 | iEquipmentSparepartService.saveOrUpdate(equipmentSparepart); | ||
106 | equipmentSparepart = iEquipmentSparepartService.getOne(sparepartQueryWrapper); | ||
107 | |||
108 | } | ||
109 | BigDecimal resetStorageNum = equipmentSparepart.getStorageNum().subtract(equipmentOutChild.getOutNum()); | ||
110 | if (resetStorageNum.doubleValue() < 0) { | ||
111 | continue; | ||
112 | //return; | ||
134 | } | 113 | } |
135 | }); | 114 | Integer version = equipmentSparepart.getVersion(); |
115 | String id = equipmentSparepart.getId(); | ||
116 | Integer executeRes = transactionTemplate.execute(transactionStatus -> { | ||
117 | int val0 = iEquipmentSparepartService.updateStorageNumById(id, resetStorageNum.doubleValue(), version); | ||
118 | if (val0 == 1 && iEquipmentOutChildService.saveOrUpdate(equipmentOutChild)) { | ||
119 | return 1; | ||
120 | } else { | ||
121 | transactionStatus.setRollbackOnly(); | ||
122 | return 0; | ||
123 | } | ||
124 | }); | ||
125 | // }); | ||
126 | } | ||
127 | // countDownLatch.await(); | ||
128 | }catch (Exception e){ | ||
129 | e.printStackTrace(); | ||
130 | throw new Exception("出库失败:"+e.getMessage()); | ||
136 | } | 131 | } |
137 | countDownLatch.await(); | 132 | |
138 | return errMsg ; | 133 | return errMsg ; |
139 | } | 134 | } |
140 | } | 135 | } | ... | ... |
1 | package com.skua.modules.equipment.vo; | ||
2 | |||
3 | import io.swagger.annotations.ApiModel; | ||
4 | import io.swagger.annotations.ApiModelProperty; | ||
5 | import lombok.Data; | ||
6 | |||
7 | /** | ||
8 | * @auther kangwei | ||
9 | * @create 2024-10-25-9:30 | ||
10 | */ | ||
11 | @Data | ||
12 | @ApiModel | ||
13 | public class DrugConsumptionVO { | ||
14 | |||
15 | @ApiModelProperty(value = "总药耗") | ||
16 | private String zyh; | ||
17 | |||
18 | @ApiModelProperty(value = "同比去年总药耗") | ||
19 | private String tbqnzyh; | ||
20 | |||
21 | @ApiModelProperty(value = "同比去年总药耗") | ||
22 | private String tbqnzyhsl; | ||
23 | |||
24 | @ApiModelProperty(value = "同比去年总药耗") | ||
25 | private String tbqnzyhbl; | ||
26 | |||
27 | @ApiModelProperty(value = "环比上月总药耗") | ||
28 | private String hbsyzyh; | ||
29 | |||
30 | @ApiModelProperty(value = "环比上月总药耗") | ||
31 | private String hbsyzyhsl; | ||
32 | |||
33 | @ApiModelProperty(value = "环比上月总药耗") | ||
34 | private String hbsyzyhbl; | ||
35 | |||
36 | @ApiModelProperty(value = "目标吨水药耗") | ||
37 | private String dsyh; | ||
38 | |||
39 | |||
40 | |||
41 | @ApiModelProperty(value = "tbqndsyhsl") | ||
42 | private String tbqndsyhsl; | ||
43 | |||
44 | @ApiModelProperty(value = "tbqndsyhbl") | ||
45 | private String tbqndsyhbl; | ||
46 | |||
47 | } |
... | @@ -94,7 +94,8 @@ public class MybatisInterceptor implements Interceptor { | ... | @@ -94,7 +94,8 @@ public class MybatisInterceptor implements Interceptor { |
94 | add("erp_distribut_material"); | 94 | add("erp_distribut_material"); |
95 | //共享风险库 | 95 | //共享风险库 |
96 | add("danger_level_manage_share"); | 96 | add("danger_level_manage_share"); |
97 | 97 | // 库存表 | |
98 | add("equipment_sparepart"); | ||
98 | }}; | 99 | }}; |
99 | 100 | ||
100 | //过滤不需要走部门ID查询的URL | 101 | //过滤不需要走部门ID查询的URL |
... | @@ -152,6 +153,8 @@ public class MybatisInterceptor implements Interceptor { | ... | @@ -152,6 +153,8 @@ public class MybatisInterceptor implements Interceptor { |
152 | || "com.skua.modules.erp.mapper.DistributContractMapper.selectList".equals(sqlId) //分销合同列表 | 153 | || "com.skua.modules.erp.mapper.DistributContractMapper.selectList".equals(sqlId) //分销合同列表 |
153 | || "com.skua.modules.erp.mapper.ERPPurchaseContractMapper.getListByDistributId".equals(sqlId) | 154 | || "com.skua.modules.erp.mapper.ERPPurchaseContractMapper.getListByDistributId".equals(sqlId) |
154 | || "com.skua.modules.system.datestandard.mapper.SysMonitorMetricInfoMapper.selectList".equals(sqlId) //点表 | 155 | || "com.skua.modules.system.datestandard.mapper.SysMonitorMetricInfoMapper.selectList".equals(sqlId) //点表 |
156 | || "com.skua.modules.equipment.mapper.EquipmentSparepartMapper.selectOne".equals(sqlId) | ||
157 | || "com.skua.modules.supplies.mapper.EquipmentSparepartSuppliesMapper.selectById".equals(sqlId) | ||
155 | ) { | 158 | ) { |
156 | log.debug("************************------sqlId------**************************" + sqlId); | 159 | log.debug("************************------sqlId------**************************" + sqlId); |
157 | return invocation.proceed(); | 160 | return invocation.proceed(); | ... | ... |
-
请 注册 或 登录 后发表评论