70cbeeb7 康伟

kangwei:药剂结算对接

1 个父辈 051fe123
......@@ -254,7 +254,9 @@ public class ErpSettlementController {
if(erpSettlementEntity==null) {
result.error500("未找到对应实体");
}else {
boolean ok = erpSettlementService.updateById(erpSettlementEntity);
//修改 入库表状态
boolean ok = erpSettlementService.settlement(erpSettlementEntity);
if(ok) {
result.success("结算成功!");
}
......
......@@ -139,12 +139,14 @@ public class TestMetricInfoController {
List<Map<String, Object>> dataList = new ArrayList<>();
List<String> timeList = null;
Map<String, Object> dataMap = null;//数据变量
String format = "";
//日数据
if (timeType.equals("2")){
timeList = DateUtil.getDaysBetween(startTime, endTime,"yyyy-MM-dd HH:mm:ss");
}
//月数据
if (timeType.equals("3")){
format = "yyyy-MM-dd";
timeList = DateUtil.getMonthsBetween(startTime, endTime,"yyyy-MM-dd HH:mm:ss");
}
for(String date : timeList){
......@@ -157,21 +159,33 @@ public class TestMetricInfoController {
}
dataList.add(dataMap);
}
Double doubleValue = 0.00d;
int daysInMonth = 31;
if(pgDataList != null ) {
for(Map<String, Object> dataMapTemp : dataList){
//select ts as time,nm as monitorId,v as monitorValue
for (Map<String, Object> paramMap : pgDataList) {
if( dataMapTemp.get("time").equals( paramMap.get("time") ) ){
if(format != null ){
daysInMonth = DateUtil.getDaysInMonth(dataMapTemp.get("time")+"-01",format);
}
for(MetricInfoVO metricInfoVO : metricInfoVOList){
dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_YX" , JSUtils.format(paramMap.get(metricInfoVO.getYxExpress()),"0.00"));//运行
dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_GZ" , JSUtils.format(paramMap.get(metricInfoVO.getGzExpress()),"0.00"));//故障
//时数据
if (timeType.equals("1")) dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_ZT" ,JSUtils.subtract( 60, paramMap.get(metricInfoVO.getYxExpress()),paramMap.get(metricInfoVO.getGzExpress()) ) );//暂停
//日数据
if (timeType.equals("2")) dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_ZT" ,JSUtils.subtract( 24*60, paramMap.get(metricInfoVO.getYxExpress()),paramMap.get(metricInfoVO.getGzExpress()) ) );//暂停
if (timeType.equals("2")) {
doubleValue = 24*60 - ConvertUtils.getDouble( paramMap.get(metricInfoVO.getYxExpress()), 0.00d) - ConvertUtils.getDouble(paramMap.get(metricInfoVO.getGzExpress()),0.00d );
if(doubleValue.doubleValue() < 0) doubleValue = 0.00d;
dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_ZT" ,JSUtils.format(doubleValue) );//暂停
}
//月数据
if (timeType.equals("3")) dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_ZT" ,JSUtils.subtract( 30*24*60, paramMap.get(metricInfoVO.getYxExpress()),paramMap.get(metricInfoVO.getGzExpress()) ) );//暂停
if (timeType.equals("3")){
doubleValue = daysInMonth*24*60 - ConvertUtils.getDouble( paramMap.get(metricInfoVO.getYxExpress()), 0.00d) - ConvertUtils.getDouble(paramMap.get(metricInfoVO.getGzExpress()),0.00d );
if(doubleValue.doubleValue() < 0) doubleValue = 0.00d;
dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_ZT" ,JSUtils.format(doubleValue) );//暂停
}
}
break;
}
......
......@@ -43,6 +43,9 @@ public interface IErpSettlementService extends IService<ErpSettlement> {
//水厂结算
List<ErpSettlementVO> waterDepartSettlement(String materialInIds);
/***结算*/
boolean settlement(ErpSettlement erpSettlementEntity);
// (供应商)送货单以及物资验收单
// ErpSettlementFormVO querySupplierSettlementFormById(String id);
//(水厂) 送货单以及物资验收单
......
......@@ -8,6 +8,7 @@ import com.skua.modules.erp.entity.ErpSettlement;
import com.skua.modules.erp.entity.ErpSettlementItem;
import com.skua.modules.erp.mapper.ErpSettlementItemMapper;
import com.skua.modules.erp.mapper.ErpSettlementMapper;
import com.skua.modules.erp.mapper.MaterialINMapper;
import com.skua.modules.erp.service.IErpSettlementService;
import com.skua.modules.erp.vo.ErpSettlementFormVO;
import com.skua.modules.erp.vo.ErpSettlementItemVO;
......@@ -17,6 +18,7 @@ import com.skua.modules.system.entity.SysDepart;
import com.skua.modules.system.mapper.SysDepartMapper;
import com.skua.tool.util.JSUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -128,6 +130,22 @@ public class ErpSettlementServiceImpl extends ServiceImpl<ErpSettlementMapper, E
public List<ErpSettlementVO> waterDepartSettlement(String materialInIds){
return this.baseMapper.waterDepartSettlement( materialInIds );
}
/***结算*/
@Transactional
public boolean settlement(ErpSettlement erpSettlementEntity){
String sql = null;
if("0".equals( erpSettlementEntity.getSettlementType() )){//供应商结算
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()+"')";
}
if("1".equals( erpSettlementEntity.getSettlementType() )){//水厂结算
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()+"')";
}
if(StringUtils.isNotEmpty(sql)){
commonSqlService.update(sql);
}
this.baseMapper.updateById( erpSettlementEntity );
return true;
}
// 根据入库单ids,获取【供应商】结算单详情
public List<ErpSettlementItemVO> querySupplierSettlementByMaterialIds(String materialInIds){
......
......@@ -121,6 +121,24 @@ public class DateUtil {
}
return days;
}
/***
* 获取月份的天数
* @param dateTime
* @param format
* @return
*/
public static int getDaysInMonth(String dateTime ,String format ){
if(format == null ){
format = "yyyy-MM-dd";
}
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format);
// 解析日期
LocalDate date = LocalDate.parse(dateTime, formatter);
// 获取当前月份的天数
int daysInMonth = (int) date.lengthOfMonth();
return daysInMonth;
}
/***
* 获取两个时间的月份
* @param start
......
......@@ -95,7 +95,7 @@ spring:
driver-class-name: com.mysql.jdbc.Driver
# 多数据源配置
pg-db:
url: jdbc:postgresql://103.85.171.27:10087/postgres?useUnicode=true&characterEncoding=UTF8
url: jdbc:postgresql://113.249.91.27:10086/postgres?useUnicode=true&characterEncoding=UTF8
username: postgres
password: jkauto@123
driver-class-name: org.postgresql.Driver
......@@ -165,10 +165,10 @@ skua:
#是否开启流程消息推送
process-enable: false
mob:
appSecret: 4e21ddb344233a5a3ec6b3446310efe1
appKey: 35e7ed05966f2
appSecret: fd97aba79649a0322934a9c88bfceff309
appKey: 3a2653ad36727
pushHostName: http://api.push.mob.com/v3/push/createPush
packageName: com.kingtrol.flutter_factoryApp
packageName: com.kingtrol.flutter_zhongye
iosProduction: 0
# 自定义逻辑,以','分割(e.g: messagePush:消息推送完后处理)
flow:
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!