kangwei:药剂结算对接
正在显示
6 个修改的文件
包含
63 行增加
和
8 行删除
... | @@ -254,7 +254,9 @@ public class ErpSettlementController { | ... | @@ -254,7 +254,9 @@ public class ErpSettlementController { |
254 | if(erpSettlementEntity==null) { | 254 | if(erpSettlementEntity==null) { |
255 | result.error500("未找到对应实体"); | 255 | result.error500("未找到对应实体"); |
256 | }else { | 256 | }else { |
257 | boolean ok = erpSettlementService.updateById(erpSettlementEntity); | 257 | //修改 入库表状态 |
258 | |||
259 | boolean ok = erpSettlementService.settlement(erpSettlementEntity); | ||
258 | if(ok) { | 260 | if(ok) { |
259 | result.success("结算成功!"); | 261 | result.success("结算成功!"); |
260 | } | 262 | } | ... | ... |
... | @@ -139,12 +139,14 @@ public class TestMetricInfoController { | ... | @@ -139,12 +139,14 @@ public class TestMetricInfoController { |
139 | List<Map<String, Object>> dataList = new ArrayList<>(); | 139 | List<Map<String, Object>> dataList = new ArrayList<>(); |
140 | List<String> timeList = null; | 140 | List<String> timeList = null; |
141 | Map<String, Object> dataMap = null;//数据变量 | 141 | Map<String, Object> dataMap = null;//数据变量 |
142 | String format = ""; | ||
142 | //日数据 | 143 | //日数据 |
143 | if (timeType.equals("2")){ | 144 | if (timeType.equals("2")){ |
144 | timeList = DateUtil.getDaysBetween(startTime, endTime,"yyyy-MM-dd HH:mm:ss"); | 145 | timeList = DateUtil.getDaysBetween(startTime, endTime,"yyyy-MM-dd HH:mm:ss"); |
145 | } | 146 | } |
146 | //月数据 | 147 | //月数据 |
147 | if (timeType.equals("3")){ | 148 | if (timeType.equals("3")){ |
149 | format = "yyyy-MM-dd"; | ||
148 | timeList = DateUtil.getMonthsBetween(startTime, endTime,"yyyy-MM-dd HH:mm:ss"); | 150 | timeList = DateUtil.getMonthsBetween(startTime, endTime,"yyyy-MM-dd HH:mm:ss"); |
149 | } | 151 | } |
150 | for(String date : timeList){ | 152 | for(String date : timeList){ |
... | @@ -157,21 +159,33 @@ public class TestMetricInfoController { | ... | @@ -157,21 +159,33 @@ public class TestMetricInfoController { |
157 | } | 159 | } |
158 | dataList.add(dataMap); | 160 | dataList.add(dataMap); |
159 | } | 161 | } |
160 | 162 | Double doubleValue = 0.00d; | |
163 | int daysInMonth = 31; | ||
161 | if(pgDataList != null ) { | 164 | if(pgDataList != null ) { |
162 | for(Map<String, Object> dataMapTemp : dataList){ | 165 | for(Map<String, Object> dataMapTemp : dataList){ |
163 | //select ts as time,nm as monitorId,v as monitorValue | 166 | //select ts as time,nm as monitorId,v as monitorValue |
164 | for (Map<String, Object> paramMap : pgDataList) { | 167 | for (Map<String, Object> paramMap : pgDataList) { |
165 | if( dataMapTemp.get("time").equals( paramMap.get("time") ) ){ | 168 | if( dataMapTemp.get("time").equals( paramMap.get("time") ) ){ |
169 | if(format != null ){ | ||
170 | daysInMonth = DateUtil.getDaysInMonth(dataMapTemp.get("time")+"-01",format); | ||
171 | } | ||
166 | for(MetricInfoVO metricInfoVO : metricInfoVOList){ | 172 | for(MetricInfoVO metricInfoVO : metricInfoVOList){ |
167 | dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_YX" , JSUtils.format(paramMap.get(metricInfoVO.getYxExpress()),"0.00"));//运行 | 173 | dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_YX" , JSUtils.format(paramMap.get(metricInfoVO.getYxExpress()),"0.00"));//运行 |
168 | dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_GZ" , JSUtils.format(paramMap.get(metricInfoVO.getGzExpress()),"0.00"));//故障 | 174 | dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_GZ" , JSUtils.format(paramMap.get(metricInfoVO.getGzExpress()),"0.00"));//故障 |
169 | //时数据 | 175 | //时数据 |
170 | if (timeType.equals("1")) dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_ZT" ,JSUtils.subtract( 60, paramMap.get(metricInfoVO.getYxExpress()),paramMap.get(metricInfoVO.getGzExpress()) ) );//暂停 | 176 | if (timeType.equals("1")) dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_ZT" ,JSUtils.subtract( 60, paramMap.get(metricInfoVO.getYxExpress()),paramMap.get(metricInfoVO.getGzExpress()) ) );//暂停 |
171 | //日数据 | 177 | //日数据 |
172 | if (timeType.equals("2")) dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_ZT" ,JSUtils.subtract( 24*60, paramMap.get(metricInfoVO.getYxExpress()),paramMap.get(metricInfoVO.getGzExpress()) ) );//暂停 | 178 | if (timeType.equals("2")) { |
179 | doubleValue = 24*60 - ConvertUtils.getDouble( paramMap.get(metricInfoVO.getYxExpress()), 0.00d) - ConvertUtils.getDouble(paramMap.get(metricInfoVO.getGzExpress()),0.00d ); | ||
180 | if(doubleValue.doubleValue() < 0) doubleValue = 0.00d; | ||
181 | dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_ZT" ,JSUtils.format(doubleValue) );//暂停 | ||
182 | } | ||
173 | //月数据 | 183 | //月数据 |
174 | if (timeType.equals("3")) dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_ZT" ,JSUtils.subtract( 30*24*60, paramMap.get(metricInfoVO.getYxExpress()),paramMap.get(metricInfoVO.getGzExpress()) ) );//暂停 | 184 | if (timeType.equals("3")){ |
185 | doubleValue = daysInMonth*24*60 - ConvertUtils.getDouble( paramMap.get(metricInfoVO.getYxExpress()), 0.00d) - ConvertUtils.getDouble(paramMap.get(metricInfoVO.getGzExpress()),0.00d ); | ||
186 | if(doubleValue.doubleValue() < 0) doubleValue = 0.00d; | ||
187 | dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_ZT" ,JSUtils.format(doubleValue) );//暂停 | ||
188 | } | ||
175 | } | 189 | } |
176 | break; | 190 | break; |
177 | } | 191 | } | ... | ... |
... | @@ -43,6 +43,9 @@ public interface IErpSettlementService extends IService<ErpSettlement> { | ... | @@ -43,6 +43,9 @@ public interface IErpSettlementService extends IService<ErpSettlement> { |
43 | //水厂结算 | 43 | //水厂结算 |
44 | List<ErpSettlementVO> waterDepartSettlement(String materialInIds); | 44 | List<ErpSettlementVO> waterDepartSettlement(String materialInIds); |
45 | 45 | ||
46 | /***结算*/ | ||
47 | boolean settlement(ErpSettlement erpSettlementEntity); | ||
48 | |||
46 | // (供应商)送货单以及物资验收单 | 49 | // (供应商)送货单以及物资验收单 |
47 | // ErpSettlementFormVO querySupplierSettlementFormById(String id); | 50 | // ErpSettlementFormVO querySupplierSettlementFormById(String id); |
48 | //(水厂) 送货单以及物资验收单 | 51 | //(水厂) 送货单以及物资验收单 | ... | ... |
... | @@ -8,6 +8,7 @@ import com.skua.modules.erp.entity.ErpSettlement; | ... | @@ -8,6 +8,7 @@ import com.skua.modules.erp.entity.ErpSettlement; |
8 | import com.skua.modules.erp.entity.ErpSettlementItem; | 8 | import com.skua.modules.erp.entity.ErpSettlementItem; |
9 | import com.skua.modules.erp.mapper.ErpSettlementItemMapper; | 9 | import com.skua.modules.erp.mapper.ErpSettlementItemMapper; |
10 | import com.skua.modules.erp.mapper.ErpSettlementMapper; | 10 | import com.skua.modules.erp.mapper.ErpSettlementMapper; |
11 | import com.skua.modules.erp.mapper.MaterialINMapper; | ||
11 | import com.skua.modules.erp.service.IErpSettlementService; | 12 | import com.skua.modules.erp.service.IErpSettlementService; |
12 | import com.skua.modules.erp.vo.ErpSettlementFormVO; | 13 | import com.skua.modules.erp.vo.ErpSettlementFormVO; |
13 | import com.skua.modules.erp.vo.ErpSettlementItemVO; | 14 | import com.skua.modules.erp.vo.ErpSettlementItemVO; |
... | @@ -17,6 +18,7 @@ import com.skua.modules.system.entity.SysDepart; | ... | @@ -17,6 +18,7 @@ import com.skua.modules.system.entity.SysDepart; |
17 | import com.skua.modules.system.mapper.SysDepartMapper; | 18 | import com.skua.modules.system.mapper.SysDepartMapper; |
18 | import com.skua.tool.util.JSUtils; | 19 | import com.skua.tool.util.JSUtils; |
19 | import org.apache.commons.collections.map.HashedMap; | 20 | import org.apache.commons.collections.map.HashedMap; |
21 | import org.apache.commons.lang3.StringUtils; | ||
20 | import org.springframework.beans.BeanUtils; | 22 | import org.springframework.beans.BeanUtils; |
21 | import org.springframework.beans.factory.annotation.Autowired; | 23 | import org.springframework.beans.factory.annotation.Autowired; |
22 | import org.springframework.stereotype.Service; | 24 | import org.springframework.stereotype.Service; |
... | @@ -128,6 +130,22 @@ public class ErpSettlementServiceImpl extends ServiceImpl<ErpSettlementMapper, E | ... | @@ -128,6 +130,22 @@ public class ErpSettlementServiceImpl extends ServiceImpl<ErpSettlementMapper, E |
128 | public List<ErpSettlementVO> waterDepartSettlement(String materialInIds){ | 130 | public List<ErpSettlementVO> waterDepartSettlement(String materialInIds){ |
129 | return this.baseMapper.waterDepartSettlement( materialInIds ); | 131 | return this.baseMapper.waterDepartSettlement( materialInIds ); |
130 | } | 132 | } |
133 | /***结算*/ | ||
134 | @Transactional | ||
135 | public boolean settlement(ErpSettlement erpSettlementEntity){ | ||
136 | String sql = null; | ||
137 | if("0".equals( erpSettlementEntity.getSettlementType() )){//供应商结算 | ||
138 | sql = "update erp_material_in mi set mi.supplier_settlement_flag = 1 where mi.id in ( select material_in_id from erp_settlement_item si where si.settlement_id = '"+erpSettlementEntity.getId()+"')"; | ||
139 | } | ||
140 | if("1".equals( erpSettlementEntity.getSettlementType() )){//水厂结算 | ||
141 | sql = "update erp_material_in mi set mi.water_depart_settlement_flag = 1 where mi.id in ( select material_in_id from erp_settlement_item si where si.settlement_id = '"+erpSettlementEntity.getId()+"')"; | ||
142 | } | ||
143 | if(StringUtils.isNotEmpty(sql)){ | ||
144 | commonSqlService.update(sql); | ||
145 | } | ||
146 | this.baseMapper.updateById( erpSettlementEntity ); | ||
147 | return true; | ||
148 | } | ||
131 | 149 | ||
132 | // 根据入库单ids,获取【供应商】结算单详情 | 150 | // 根据入库单ids,获取【供应商】结算单详情 |
133 | public List<ErpSettlementItemVO> querySupplierSettlementByMaterialIds(String materialInIds){ | 151 | public List<ErpSettlementItemVO> querySupplierSettlementByMaterialIds(String materialInIds){ | ... | ... |
... | @@ -121,6 +121,24 @@ public class DateUtil { | ... | @@ -121,6 +121,24 @@ public class DateUtil { |
121 | } | 121 | } |
122 | return days; | 122 | return days; |
123 | } | 123 | } |
124 | |||
125 | /*** | ||
126 | * 获取月份的天数 | ||
127 | * @param dateTime | ||
128 | * @param format | ||
129 | * @return | ||
130 | */ | ||
131 | public static int getDaysInMonth(String dateTime ,String format ){ | ||
132 | if(format == null ){ | ||
133 | format = "yyyy-MM-dd"; | ||
134 | } | ||
135 | DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format); | ||
136 | // 解析日期 | ||
137 | LocalDate date = LocalDate.parse(dateTime, formatter); | ||
138 | // 获取当前月份的天数 | ||
139 | int daysInMonth = (int) date.lengthOfMonth(); | ||
140 | return daysInMonth; | ||
141 | } | ||
124 | /*** | 142 | /*** |
125 | * 获取两个时间的月份 | 143 | * 获取两个时间的月份 |
126 | * @param start | 144 | * @param start | ... | ... |
... | @@ -95,7 +95,7 @@ spring: | ... | @@ -95,7 +95,7 @@ spring: |
95 | driver-class-name: com.mysql.jdbc.Driver | 95 | driver-class-name: com.mysql.jdbc.Driver |
96 | # 多数据源配置 | 96 | # 多数据源配置 |
97 | pg-db: | 97 | pg-db: |
98 | url: jdbc:postgresql://103.85.171.27:10087/postgres?useUnicode=true&characterEncoding=UTF8 | 98 | url: jdbc:postgresql://113.249.91.27:10086/postgres?useUnicode=true&characterEncoding=UTF8 |
99 | username: postgres | 99 | username: postgres |
100 | password: jkauto@123 | 100 | password: jkauto@123 |
101 | driver-class-name: org.postgresql.Driver | 101 | driver-class-name: org.postgresql.Driver |
... | @@ -165,10 +165,10 @@ skua: | ... | @@ -165,10 +165,10 @@ skua: |
165 | #是否开启流程消息推送 | 165 | #是否开启流程消息推送 |
166 | process-enable: false | 166 | process-enable: false |
167 | mob: | 167 | mob: |
168 | appSecret: 4e21ddb344233a5a3ec6b3446310efe1 | 168 | appSecret: fd97aba79649a0322934a9c88bfceff309 |
169 | appKey: 35e7ed05966f2 | 169 | appKey: 3a2653ad36727 |
170 | pushHostName: http://api.push.mob.com/v3/push/createPush | 170 | pushHostName: http://api.push.mob.com/v3/push/createPush |
171 | packageName: com.kingtrol.flutter_factoryApp | 171 | packageName: com.kingtrol.flutter_zhongye |
172 | iosProduction: 0 | 172 | iosProduction: 0 |
173 | # 自定义逻辑,以','分割(e.g: messagePush:消息推送完后处理) | 173 | # 自定义逻辑,以','分割(e.g: messagePush:消息推送完后处理) |
174 | flow: | 174 | flow: | ... | ... |
-
请 注册 或 登录 后发表评论