From 5f6087d0a9054e227f28fe7790f0ae5856261598 Mon Sep 17 00:00:00 2001 From: hongchao <3228015117@qq.com> Date: Fri, 26 Sep 2025 16:32:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=B9=E7=94=A8=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bonus/common/biz/utils/HttpHelper.java | 64 +++ .../bonus/common/biz/utils/StringHelper.java | 261 +++++++++++ .../domain/lease/MaterialLeaseApplyInfo.java | 3 + .../controller/IwsCostPushController.java | 84 ++++ .../material/push/domain/CostPushBean.java | 2 + .../material/push/domain/IwsCostPushBean.java | 32 +- .../material/push/domain/ProIdsBean.java | 2 + .../push/mapper/IwsCostPushMapper.java | 25 + .../push/service/IwsCostPushService.java | 9 + .../service/impl/IwsCostPushServiceImpl.java | 437 +++++++++++++++++- .../material/push/task/IwsCostPushTask.java | 4 + .../material/clz/MaterialLeaseInfoMapper.xml | 12 +- .../material/push/IwsCostPushMapper.xml | 263 ++++++++++- .../mapper/material/push/MybatisGenerator.xml | 62 ++- 14 files changed, 1219 insertions(+), 41 deletions(-) create mode 100644 bonus-common-biz/src/main/java/com/bonus/common/biz/utils/StringHelper.java diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/utils/HttpHelper.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/utils/HttpHelper.java index d6794615..8e4605d9 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/utils/HttpHelper.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/utils/HttpHelper.java @@ -1,5 +1,8 @@ package com.bonus.common.biz.utils; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.bonus.common.security.utils.SecurityUtils; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; @@ -13,6 +16,8 @@ import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; /** * @author bonus @@ -35,6 +40,29 @@ public class HttpHelper { return responseContent; } + public static String sendHttpPostPushCost(String url, String JSONBody) throws Exception { + // 获取token + String token = getToken(); + if (StringHelper.isEmpty(token)) { + System.err.println("token获取失败-=========:"); + return null; + } + System.err.println("JSONBody-=========:" + JSONBody); + CloseableHttpClient httpClient = HttpClients.createDefault(); + HttpPost httpPost = new HttpPost(url); + httpPost.addHeader("Content-Type", "application/json"); + httpPost.addHeader("Authorization", token); + httpPost.setEntity(new StringEntity(JSONBody)); + CloseableHttpResponse response = httpClient.execute(httpPost); +// System.out.println(response.getStatusLine().getStatusCode() + "\n"); + HttpEntity entity = response.getEntity(); + String responseContent = EntityUtils.toString(entity, "UTF-8"); +// System.out.println(responseContent); + response.close(); + httpClient.close(); + return responseContent; + } + public static String sendHttpPost(String url,String token,String content,String intelligentAppKey) throws Exception { System.out.println("JSONBody-=========:" + content); try (CloseableHttpClient client = HttpClients.createDefault()) { @@ -156,6 +184,42 @@ public class HttpHelper { // return redisCode; // } + /** + * 获取token + * + * @return + */ + private static String getToken() { + // String tokenUrl = "http://10.138.55.113:8036/micro-server/zygqj/generatcorToekn"; + String tokenUrl = "http://10.138.55.64:8036/micro-server/zygqj/generatcorToekn"; + try { + + String loginName= SecurityUtils.getLoginUser().getSysUser().getUserName(); +// String loginName="liucj7431"; + Map map = new HashMap(); + JSONObject data = new JSONObject(); + data.put("account", loginName); + map.put("body", AesEncryptUtils.encrypt(JSONObject.toJSONString(data), KEY)); + String body = JSONObject.toJSONString(map); + String result = HttpHelper.sendHttpPostForToken(tokenUrl, body); + System.err.println("dataString-=========:" + result); + if (!StringHelper.isEmpty(result)) { + JSONObject object = JSONObject.parseObject(result); + String code = object.getString("code"); + if ("200".equals(code)) { + String token = object.getString("data"); + return token; + } + } else { + return null; + } + } catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); + return null; + } + return null; + } /** * 不带鉴权的请求 diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/utils/StringHelper.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/utils/StringHelper.java new file mode 100644 index 00000000..00e1ed00 --- /dev/null +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/utils/StringHelper.java @@ -0,0 +1,261 @@ +package com.bonus.common.biz.utils; + +import java.io.ByteArrayOutputStream; +import java.text.DecimalFormat; + +public class StringHelper { + + private static String hexString = "0123456789ABCDEF"; + + public static String replaceAll(String str, String oldStr, String newStr) { + return str.replaceAll(oldStr, newStr); + } + + public static boolean contains(String s1, String s2) { + if (isEmpty(s1)) { + return false; + } + return s1.contains(s2); + } + + public static int getInt(String valStr){ + return getInt(valStr,0); + } + + public static int getInt(String valStr,int defaulVal){ + int val = 0; + try{ + val = Integer.parseInt(valStr); + }catch (Exception e) { + val = defaulVal; + } + return val; + } + + public static float getFloat(String valStr){ + return getFloat(valStr,0); + } + + public static float getFloat(String valStr,int defaulVal){ + float val = 0; + try{ + val = Float.parseFloat(valStr); + }catch (Exception e) { + val = defaulVal; + } + return val; + } + + /* + * 将字符串编码成16进制数字,适用于所有字符(包括中文) + */ + public static String encode(String str) { + // 根据默认编码获取字节数组 + byte[] bytes = str.getBytes(); + StringBuilder sb = new StringBuilder(bytes.length * 2); + // 将字节数组中每个字节拆解成2位16进制整数 + for (int i = 0; i < bytes.length; i++) { + sb.append(hexString.charAt((bytes[i] & 0xf0) >> 4)); + sb.append(hexString.charAt((bytes[i] & 0x0f) >> 0)); + } + return sb.toString(); + } + + public static String decode(String bytes) { + ByteArrayOutputStream baos = new ByteArrayOutputStream(bytes.length() / 2); + // 将每2位16进制整数组装成一个字节 + for (int i = 0; i < bytes.length(); i += 2) + baos.write((hexString.indexOf(bytes.charAt(i)) << 4 | hexString.indexOf(bytes.charAt(i + 1)))); + return new String(baos.toByteArray()); + } + + public static String fillPrefixZero(int v, int len) { + String vStr = v + ""; + while (vStr.length() < len) { + vStr = "0" + vStr; + } + return vStr; + } + + public static boolean isEmpty(String str) { + if (str == null || "".equals(str.trim()) || "null".equals(str) || "undefined".equals(str)) { + return true; + } + return false; + } + + /** + * 判断字符串 不为空 + */ + public static boolean isNotEmpty(String str) { + return !isEmpty(str); + } + + /** + * 处理时间,获取编号 + */ + public static String time2Code(String time) { + if (isNotEmpty(time)) { + time = time.replace("-", "").replace(" ", "").replace(":", ""); + } + return time; + } + public static String formatMoneyData(double temp){ + DecimalFormat df = new DecimalFormat("#0.00");// 构造方法的字符格式这里如果小数不足2位,会以0补足. + String tmp = df.format(temp); + return tmp; + } + public static float formatMoney2Data(double temp){ + String tmp = formatMoneyData(temp); + float t = getFloat(tmp); + return t; + } + public static String formatData(float temp){ + DecimalFormat df = new DecimalFormat("#0.000");// 构造方法的字符格式这里如果小数不足2位,会以0补足. + String tmp = df.format(temp); + return tmp; + } + public static float format2Data(float temp){ + String tmp = formatData(temp); + float t = getFloat(tmp); + return t; + } + + /** + * 检查是否存在数据飘逸 + */ + public static float disposeDrift(Float num){ + String strNum = num.toString(); + String endStr = strNum.substring(strNum.indexOf(".") + 1); + String startStr = strNum.substring(0, strNum.indexOf(".")); + if (endStr.indexOf("999") >= 0) { + int start = endStr.indexOf("999"); + if (start == 0) { + num = Float.parseFloat(startStr) + 1f; + } else { + + String a = "0"; + String c = ""; + while(endStr.startsWith(a)){ + a+="0"; + c+="0"; + } + endStr = endStr.substring(0, start); + endStr = c+(Integer.parseInt(endStr) + 1) + ""; + num = Float.parseFloat(startStr + "." + endStr); + } + } else if (endStr.indexOf("000") >= 0) { + int start = endStr.indexOf("000"); + if (start == 0) { + num = Float.parseFloat(startStr); + } else { + num = Float.parseFloat(strNum.substring(0, strNum.indexOf("000"))); + } + } + return num; + } + + public static String judgeCompany(Integer orgId){ + String company = ""; + if(35 == orgId){ + //送电 + company = "1"; + }else if(36 == orgId ){ + //变电 + company = "9"; + }else if(37 == orgId){ + //大件 + company = "12"; + }else if(38 == orgId){ + //广源 + company = "2"; + }else if(39 == orgId){ + //宏送 + company = "8"; + }else if(40 == orgId){ + //宏变 + company = "3"; + }else{ + company = ""; + } + return company; + } + + //String字符串相似度比较 + public static float getSimilarityRatio(String str, String target, boolean isIgnore) { + float ret = 0; + DecimalFormat decimalFormat=new DecimalFormat(".0"); + + if (Math.max(str.length(), target.length()) == 0) { + ret = 1; + } else { + ret = 1 - (float) compare(str, target, isIgnore) / Math.max(str.length(), target.length()); + } + ret=Float.parseFloat(decimalFormat.format(ret*100)); + return ret; + } + + public static int compare(String str, String target, boolean isIgnore) { + int d[][]; // 矩阵 + int n = str.length(); + int m = target.length(); + int i; // 遍历str的 + int j; // 遍历target的 + char ch1; // str的 + char ch2; // target的 + int temp; // 记录相同字符,在某个矩阵位置值的增量,不是0就是1 + if (n == 0) { + return m; + } + if (m == 0) { + return n; + } + d = new int[n + 1][m + 1]; + for (i = 0; i <= n; i++) { // 初始化第一列 + d[i][0] = i; + } + + for (j = 0; j <= m; j++) { // 初始化第一行 + d[0][j] = j; + } + + for (i = 1; i <= n; i++) { // 遍历str + ch1 = str.charAt(i - 1); + // 去匹配target + for (j = 1; j <= m; j++) { + ch2 = target.charAt(j - 1); + if (isIgnore) { + if (ch1 == ch2 || ch1 == ch2 + 32 || ch1 + 32 == ch2) { + temp = 0; + } else { + temp = 1; + } + } else { + if (ch1 == ch2) { + temp = 0; + } else { + temp = 1; + } + } + + // 左边+1,上边+1, 左上角+temp取最小 + d[i][j] = min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + temp); + } + } + return d[n][m]; + } + + public static int min(int one, int two, int three) { + return (one = one < two ? one : two) < three ? one : three; + } + + + + public static boolean validatePassword(String password, int minLength) { + String regex = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[$@$!%*?&])[A-Za-z\\d$@$!%*?&]{" + minLength + ",}$"; + return password.matches(regex); + } + + + +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/lease/MaterialLeaseApplyInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/lease/MaterialLeaseApplyInfo.java index 04ee2660..a0b26f43 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/lease/MaterialLeaseApplyInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/lease/MaterialLeaseApplyInfo.java @@ -329,4 +329,7 @@ public class MaterialLeaseApplyInfo extends BaseEntity { @ApiModelProperty(value = "工程名称") @Excel(name = "工程名称") private String proName; + + @ApiModelProperty(value = "是否人为修改:0:否,1:是") + private Integer isUpdate; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/controller/IwsCostPushController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/controller/IwsCostPushController.java index f9daa2cd..1cf205c0 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/controller/IwsCostPushController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/controller/IwsCostPushController.java @@ -1,5 +1,10 @@ package com.bonus.material.push.controller; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.bonus.common.biz.utils.AesEncryptUtils; +import com.bonus.common.biz.utils.HttpHelper; +import com.bonus.common.biz.utils.StringHelper; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.poi.ExcelUtil; import com.bonus.common.core.web.controller.BaseController; @@ -259,4 +264,83 @@ public class IwsCostPushController extends BaseController { List list = iwsCostPushService.getEquipmentListByAgreementCode(info); return AjaxResult.success(getDataTable(list)); } + + /** + * 机具费用推送 + * @return + */ + @PostMapping("/materialCostPush") + @ApiOperation("机具费用推送") + public AjaxResult materialCostPush(@RequestBody IwsCostPushBean obj) { + return iwsCostPushService.materialCostPush(obj); + } + + /** + * 机具费用推送数据回退 + * + * @param o + * @return + */ + @RequestMapping(value = "materialCostPushReturn", method = RequestMethod.POST) + @ApiOperation("机具费用推送回退") + public AjaxResult materialCostPushReturn(@RequestBody IwsCostPushBean o) { + try { + String body = o.getBody(); + if (!StringHelper.isEmpty(body)) { + // 解密 + String decResult = AesEncryptUtils.decrypt(body, HttpHelper.KEY); + logger.info("接收的数据:" + decResult); + if (!StringHelper.isEmpty(decResult)) { + JSONArray resultObj = JSONArray.parseArray(decResult); + if (resultObj != null && resultObj.size() > 0) { + for (int i = 0; i < resultObj.size(); i++) { + // 循环遍历集合 + JSONObject tempObj = resultObj.getJSONObject(i); + String id = tempObj.getString("id"); + String pushStatus = tempObj.getString("pushStatus"); + String pushRemark = tempObj.getString("pushRemark"); + String typeString = tempObj.getString("type"); + IwsCostPushBean bean = new IwsCostPushBean(); + bean.setId(id); + bean.setPushRemark(pushRemark); + bean.setPushStatus(pushStatus); + bean.setType(typeString); + iwsCostPushService.materialCostPushReturn(bean); + } + } + } else { + return AjaxResult.error("周转工器具费用回退数据接收更新失败---解密失败"); + } + } else { + return AjaxResult.error("周转工器具费用回退数据接收更新失败---参数为空"); + } + + } catch (Exception e) { + // TODO: handle exception + logger.error(e.toString(), e); + return AjaxResult.error("周转工器具费用回退数据接收更新失败---服务器程序错误"); + } + return AjaxResult.success("周转工器具费用回退数据接收更新成功"); + } + + /** + * 安全工机具费用推送 + * @return + */ + @PostMapping("/safetyMaterialCostPush") + @ApiOperation("安全工机具费用推送") + public AjaxResult safetyMaterialCostPush(@RequestBody IwsCostPushBean obj) { + return iwsCostPushService.safetyMaterialCostPush(obj); + } + + /** + * 安全工机具(消费性)费用推送 + * @return + */ + @PostMapping("/safetyConsumeMaterialCostPush") + @ApiOperation("安全工机具(消费性)费用推送") + public AjaxResult safetyConsumeMaterialCostPush(@RequestBody IwsCostPushBean obj) { + return iwsCostPushService.safetyConsumeMaterialCostPush(obj); + } + } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/domain/CostPushBean.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/domain/CostPushBean.java index e52a64a3..cf3fe55c 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/domain/CostPushBean.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/domain/CostPushBean.java @@ -118,5 +118,7 @@ public class CostPushBean implements java.io.Serializable { private Integer status; private String sltTime; + + private String agreementId; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/domain/IwsCostPushBean.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/domain/IwsCostPushBean.java index 051259be..ae62548b 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/domain/IwsCostPushBean.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/domain/IwsCostPushBean.java @@ -7,11 +7,9 @@ import lombok.Data; import lombok.experimental.Accessors; import javax.validation.constraints.NotBlank; -import javax.validation.constraints.Size; import java.io.Serializable; import java.math.BigDecimal; import java.time.LocalDateTime; -import java.util.List; /** * @author : 阮世耀 @@ -120,13 +118,13 @@ public class IwsCostPushBean implements Serializable { private String year; @Excel(name = "是否结算", readConverterExp = "0=未结算,1=已结算", sort = 6) - private Byte isSettlement = 0; + private Integer isSettlement; @ApiModelProperty(value = "安全工器具是否结算, 0未结算,1=已结算") - private Byte safetyIsSettlement = 0; + private Integer safetyIsSettlement; @Excel(name = "结算类型", readConverterExp = "1=工器具,2=安全工器具") - private Byte settlementType; + private Integer settlementType; // 结算时间 @Excel(name = "结算时间", dateFormat = "yyyy-MM-dd HH:mm:ss", sort = 7) @@ -183,4 +181,28 @@ public class IwsCostPushBean implements Serializable { private String maTypeName; private String maModelName; + + private String[] agreementIds; + + private String agreementIdsStr; + + private String pushStatus; + + private String pushTime; + + private String body; + + @ApiModelProperty(value = "是否是消耗性:0:不消耗,1:消耗") + private Integer comsumeType; + + @ApiModelProperty(value = "2:安全工机具,1:工机具") + private Integer category; + + private String submitUser; + + private Long quantity; + + private BigDecimal netPrice; + + private BigDecimal cost; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/domain/ProIdsBean.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/domain/ProIdsBean.java index fba3cf96..5aa56380 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/domain/ProIdsBean.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/domain/ProIdsBean.java @@ -43,4 +43,6 @@ public class ProIdsBean { private String unitName; private String externalId; + + private String agreementIds; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/mapper/IwsCostPushMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/mapper/IwsCostPushMapper.java index dc4dadff..cb78185c 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/mapper/IwsCostPushMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/mapper/IwsCostPushMapper.java @@ -3,6 +3,7 @@ package com.bonus.material.push.mapper; import com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo; import com.bonus.material.clz.domain.vo.lease.LeaseTotalInfo; import com.bonus.material.push.domain.IwsCostPushBean; +import com.bonus.material.push.domain.ProIdsBean; import com.bonus.material.settlement.domain.vo.PeriodCostResultVo; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -85,4 +86,28 @@ public interface IwsCostPushMapper { * @return */ List getEquipmentListByAgreementCode(IwsCostPushBean leaseTotalInfo); + + List getProIdsByAgreementIds(@Param("agreementIds") String[] agreementIds); + + List getRentalCostList(IwsCostPushBean proIdsBean); + + List getBalanceCostList(IwsCostPushBean proIdsBean); + + void updateCostPushCheckStatus(IwsCostPushBean proIdsBean); + + void updatePushProjectInfo(IwsCostPushBean pushBean); + + void updatePushBsd(IwsCostPushBean pushBean); + + void updatePushProjectInfoReturn(IwsCostPushBean costDto); + + void updatePushBsdReturn(IwsCostPushBean costDto); + + List getSafetyRentalCostList(IwsCostPushBean proIdsBean); + + List getSafetyBalanceCostList(IwsCostPushBean proIdsBean); + + String getMonth(IwsCostPushBean taskId); + + List getSafetyConsumeCostList(IwsCostPushBean proIdsBean); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/service/IwsCostPushService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/service/IwsCostPushService.java index 09581a06..eb99e0d4 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/service/IwsCostPushService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/service/IwsCostPushService.java @@ -49,4 +49,13 @@ public interface IwsCostPushService { * 根据工程/往来单位/协议号查询机具信息 */ List getEquipmentListByAgreementCode(IwsCostPushBean record); + + AjaxResult materialCostPush(IwsCostPushBean obj); + + + AjaxResult materialCostPushReturn(IwsCostPushBean bean); + + AjaxResult safetyMaterialCostPush(IwsCostPushBean obj); + + AjaxResult safetyConsumeMaterialCostPush(IwsCostPushBean obj); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/service/impl/IwsCostPushServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/service/impl/IwsCostPushServiceImpl.java index c6411175..c6abe969 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/service/impl/IwsCostPushServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/service/impl/IwsCostPushServiceImpl.java @@ -1,13 +1,20 @@ package com.bonus.material.push.service.impl; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.alibaba.nacos.common.utils.CollectionUtils; import com.bonus.common.biz.config.DateTimeHelper; +import com.bonus.common.biz.utils.AesEncryptUtils; +import com.bonus.common.biz.utils.HttpHelper; +import com.bonus.common.biz.utils.StringHelper; import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.StringUtils; import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.common.security.utils.SecurityUtils; import com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo; import com.bonus.material.clz.domain.vo.lease.LeaseTotalInfo; import com.bonus.material.push.domain.IwsCostPushBean; +import com.bonus.material.push.domain.ProIdsBean; import com.bonus.material.push.mapper.IwsCostPushMapper; import com.bonus.material.push.service.IwsCostPushService; import com.bonus.material.settlement.domain.SltAgreementInfo; @@ -16,6 +23,7 @@ import com.bonus.material.settlement.domain.vo.PeriodCostResultVo; import com.bonus.material.settlement.domain.vo.PeriodCostSummaryVo; import com.bonus.material.settlement.domain.vo.SltInfoVo; import com.bonus.material.settlement.service.ISltAgreementInfoService; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -39,6 +47,7 @@ import java.util.stream.Stream; * @Description: 描述 */ @Service +@Slf4j public class IwsCostPushServiceImpl implements IwsCostPushService { @Resource @@ -87,8 +96,9 @@ public class IwsCostPushServiceImpl implements IwsCostPushService { @Override public AjaxResult computeTheMonthCost(IwsCostPushBean costDto) { // 获取当前年月 例如:2025-01 - // todo String month = DateTimeHelper.getNowMonth(); - String month = "2025-08"; + // todo + String month = DateTimeHelper.getNowMonth(); +// String month = "2025-08"; // 获取当月第一天的日期和最后一天日期 LocalDateTime firstDayOfMonth = getFirstDayOfMonth(month); LocalDateTime lastDayOfMonth = getLastDayOfMonthZ(month); @@ -96,12 +106,12 @@ public class IwsCostPushServiceImpl implements IwsCostPushService { // 当月第一天 LocalDate firstDay = LocalDate.now().withDayOfMonth(1); // todo 测试用 - firstDay = LocalDate.of(2025, 8, 1); +// LocalDate firstDay = LocalDate.of(2025, 8, 1); Date firstDate = Date.from(firstDay.atStartOfDay(zone).toInstant()); // 当月最后一天 LocalDate lastDay = LocalDate.now().withDayOfMonth(LocalDate.now().lengthOfMonth()); // todo 测试用 - lastDay = LocalDate.of(2025, 8, 31); +// LocalDate lastDay = LocalDate.of(2025, 8, 31); Date lastDate = Date.from(lastDay.atStartOfDay(zone).toInstant()); // 塞入当前年月到参数中 @@ -254,7 +264,7 @@ public class IwsCostPushServiceImpl implements IwsCostPushService { // 转化未结算工器具费用 for (PeriodCostSummaryVo vo : unsettlementEquipmentLeaseCosts) { resultArray.add(new IwsCostPushBean() - .setAgreementId(vo.getAgreementId()).setTaskId(costDto.getTaskId()).setSettlementType((byte) 1) + .setAgreementId(vo.getAgreementId()).setTaskId(costDto.getTaskId()).setSettlementType(1) .setLeaseMoney(vo.getTotalLeaseCost()) .setConsumeMoney(vo.getTotalConsumeCost()) ); @@ -262,7 +272,7 @@ public class IwsCostPushServiceImpl implements IwsCostPushService { // 转化未结算安全工器具费用 for (PeriodCostSummaryVo vo : unsettlementSafetyEquipmentLeaseCosts) { resultArray.add(new IwsCostPushBean() - .setAgreementId(vo.getAgreementId()).setTaskId(costDto.getTaskId()).setSettlementType((byte) 2) + .setAgreementId(vo.getAgreementId()).setTaskId(costDto.getTaskId()).setSettlementType(2) .setLeaseMoney(vo.getTotalLeaseCost()) .setConsumeMoney(vo.getTotalConsumeCost()) ); @@ -270,7 +280,7 @@ public class IwsCostPushServiceImpl implements IwsCostPushService { // 转换已结算工器具费用 for (SltAgreementInfo vo : settlementEquipmentCosts) { resultArray.add(new IwsCostPushBean() - .setAgreementId(vo.getAgreementId()).setTaskId(costDto.getTaskId()).setSettlementType((byte) 1) + .setAgreementId(vo.getAgreementId()).setTaskId(costDto.getTaskId()).setSettlementType(1) .setLeaseMoney(vo.getLeaseCost()).setRepairMoney(vo.getRepairCost()) .setLostMoney(vo.getLoseCost()).setScrapMoney(vo.getScrapCost()) .setConsumeMoney(vo.getConsumeCost()) @@ -279,7 +289,7 @@ public class IwsCostPushServiceImpl implements IwsCostPushService { // 转换已结算安全工器具费用 for (SltAgreementInfo vo : settlementSafetyEquipmentCosts) { resultArray.add(new IwsCostPushBean() - .setAgreementId(vo.getAgreementId()).setTaskId(costDto.getTaskId()).setSettlementType((byte) 2) + .setAgreementId(vo.getAgreementId()).setTaskId(costDto.getTaskId()).setSettlementType(2) .setLeaseMoney(vo.getLeaseCost()).setRepairMoney(vo.getRepairCost()) .setLostMoney(vo.getLoseCost()).setScrapMoney(vo.getScrapCost()) .setConsumeMoney(vo.getConsumeCost()) @@ -636,4 +646,415 @@ public class IwsCostPushServiceImpl implements IwsCostPushService { } return recordList; } + + /** + * 机具费用推送 + * + */ + @Override + public AjaxResult materialCostPush(IwsCostPushBean costDto) { + List proIdsBeans = new ArrayList<>(); + if(costDto.getAgreementIds().length>0){ + // 将协议合并成工程 + proIdsBeans = iwsCostPushMapper.getProIdsByAgreementIds(costDto.getAgreementIds()); + String month = iwsCostPushMapper.getMonth(costDto); + //获取费用列表 + for (IwsCostPushBean proIdsBean : proIdsBeans) { + proIdsBean.setUserName(SecurityUtils.getLoginUser().getSysUser().getUserName()); + proIdsBean.setSubmitUser(SecurityUtils.getLoginUser().getSysUser().getNickName()); + proIdsBean.setTaskId(costDto.getTaskId()); + proIdsBean.setMonth(month); + List list = getMonthCosts(proIdsBean); + if(CollectionUtils.isNotEmpty(list)){ + //分段推送 + forHttpYouer(list,proIdsBean); + } + } + } + return AjaxResult.success(proIdsBeans); + + } + + /** + * 协议合并成工程 + * + */ + + public List getMonthCosts(IwsCostPushBean proIdsBean){ + List list = new ArrayList<>(); + //确定各个工程下的协议有哪些 + proIdsBean.setAgreementIds(proIdsBean.getAgreementIdsStr().split( ",")); + proIdsBean.setType("1"); + proIdsBean.setSettlementType(1); + // 获取租赁详情列表 + List rentalCostList = iwsCostPushMapper.getRentalCostList(proIdsBean); + + // 获取丢失详情列表 + proIdsBean.setType("2"); + List lostCostList = iwsCostPushMapper.getBalanceCostList(proIdsBean); + + // 获取维修详情列表 + proIdsBean.setType("3"); + List repairCostList = iwsCostPushMapper.getBalanceCostList(proIdsBean); + + // 获取报废详情列表 + proIdsBean.setType("4"); + List scrapCostList = iwsCostPushMapper.getBalanceCostList(proIdsBean); + list.addAll(rentalCostList); + list.addAll(lostCostList); + list.addAll(repairCostList); + list.addAll(scrapCostList); + + return list; + } + + + /** + * 分段推送 + * + */ + private void forHttpYouer(List list,IwsCostPushBean proIdsBean) { + System.err.println("list-=========:" + list.toString()); + String content = JSONObject.toJSONString(list); + String encrypt; + try { + // 数据推送,http请求 + encrypt = AesEncryptUtils.encrypt(content, HttpHelper.KEY); + log.error("解密之后的数据-=========:" + AesEncryptUtils.decrypt(encrypt, HttpHelper.KEY)); + System.err.println("解密之后的数据-=========:" + AesEncryptUtils.decrypt(encrypt, HttpHelper.KEY)); + Map map = new HashMap(); + map.put("body", encrypt); + String body = JSONObject.toJSONString(map); + // String url = "http://10.138.55.113:8036/micro-server/zygqj/syncProjectCostsData"; + String url = "http://10.138.55.64:8036/micro-server/zygqj/syncProjectCostsData"; + String data = HttpHelper.sendHttpPostPushCost(url, body); + System.err.println("dataString-=========:" + data); + + list = resultDataHandler(data, list,proIdsBean); + // 创建数据更新参数 + IwsCostPushBean pushBean = new IwsCostPushBean(); + // 推送完成,循环更新本次审核的数据 + for (int i = 0; i < list.size(); i++) { + // 获取单个数据 + IwsCostPushBean bean = list.get(i); + String pushStatus = "0"; + String pushStatuString = bean.getPushStatus(); + if (StringHelper.isEmpty(pushStatuString)) { + pushStatus = "1"; + } else { + pushStatus = pushStatuString; + } + pushBean.setPushStatus(pushStatus); + pushBean.setPushRemark(bean.getPushRemark()); + pushBean.setPushTime(DateTimeHelper.getNowTime()); + pushBean.setId(bean.getId()); + // 获取费用类型 + String type = bean.getType(); + if ("1".equals(type)) { + // 判断是租赁费用,更新租赁费用数据 + iwsCostPushMapper.updatePushProjectInfo(pushBean); + } else { + iwsCostPushMapper.updatePushBsd(pushBean); + } + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + /** + * 接口返回结果处理 + * + * @param data + * @param list + * @return + * @throws Exception + */ + private List resultDataHandler(String data, List list,IwsCostPushBean proIdsBean) throws Exception { + JSONObject object = JSONObject.parseObject(data); + System.err.println(data); + String code = object.getString("code"); + if ("200".equals(code)) { + iwsCostPushMapper.updateCostPushCheckStatus(proIdsBean); + String dataResultString = object.getString("data"); + // 数据解密 + String dataArrayString = AesEncryptUtils.decrypt(dataResultString, HttpHelper.KEY); + System.err.println("dataArrayString-=========:" + dataArrayString); + JSONArray dataArray = JSONArray.parseArray(dataArrayString); + if (dataArray != null && dataArray.size() > 0) { + // 有数据 推送异常(状态异常) + for (int i = 0; i < dataArray.size(); i++) { + JSONObject dataObject = dataArray.getJSONObject(i); + String resultId = dataObject.getString("id"); + String resultPushRemark = dataObject.getString("pushRemark"); + String pushStatus = "2"; + for (int j = 0; j < list.size(); j++) { + IwsCostPushBean rentalCostsBean = list.get(j); + String id = rentalCostsBean.getId(); + if (resultId.equals(id)) { + rentalCostsBean.setPushRemark(resultPushRemark); + rentalCostsBean.setPushStatus(pushStatus); + list.set(j, rentalCostsBean); + } else { + continue; + } + } + } + }else { //推送成功 + for(int i = 0;i < list.size(); i++) { + IwsCostPushBean rentalCostsBean = list.get(i); + rentalCostsBean.setPushStatus("1"); + rentalCostsBean.setPushRemark("推送成功"); + list.set(i, rentalCostsBean); + } + } + return list; + } else { + for(int i = 0;i < list.size(); i++) { + IwsCostPushBean rentalCostsBean = list.get(i); + rentalCostsBean.setPushStatus("0"); + rentalCostsBean.setPushRemark("推送失败,接口异常,请联系开发人员排查问题");; + list.set(i, rentalCostsBean); + } + return list; + } + } + + /** + * 机具费用推送数据回退 + * + */ + @Override + public AjaxResult materialCostPushReturn(IwsCostPushBean costDto) { + String type = costDto.getType(); + if("1".equals(type)){ + //租赁费用 + iwsCostPushMapper.updatePushProjectInfoReturn(costDto); + }else if("2".equals(type) || "3".equals(type) || "4".equals(type)){ + //丢失费用、维修费用、报废费用 + iwsCostPushMapper.updatePushBsdReturn(costDto); + } else { + // 补充:处理未知类型,避免静默失败 + return AjaxResult.error("不支持的费用类型:" + type); + } + return AjaxResult.success(); + } + + /** + * 安全机具费用推送 + * + */ + @Override + public AjaxResult safetyMaterialCostPush(IwsCostPushBean costDto) { + List proIdsBeans = new ArrayList<>(); + if(costDto.getAgreementIds().length>0){ + // 将协议合并成工程 + proIdsBeans = iwsCostPushMapper.getProIdsByAgreementIds(costDto.getAgreementIds()); + String month = iwsCostPushMapper.getMonth(costDto); + //获取费用列表 + for (IwsCostPushBean proIdsBean : proIdsBeans) { + proIdsBean.setUserName(SecurityUtils.getLoginUser().getSysUser().getUserName()); + proIdsBean.setSubmitUser(SecurityUtils.getLoginUser().getSysUser().getNickName()); + proIdsBean.setTaskId(costDto.getTaskId()); + proIdsBean.setMonth(month); + List list = getSafetyMonthCosts(proIdsBean); + if(CollectionUtils.isNotEmpty(list)){ + //分段推送 + forHttpYouerSafety(list,proIdsBean); + + } + } + } + return AjaxResult.success(proIdsBeans); + + } + + public List getSafetyMonthCosts(IwsCostPushBean proIdsBean){ + List list = new ArrayList<>(); + //确定各个工程下的协议有哪些 + proIdsBean.setAgreementIds(proIdsBean.getAgreementIdsStr().split( ",")); + proIdsBean.setType("1"); + proIdsBean.setSettlementType(2); + proIdsBean.setComsumeType(0); + + // 获取租赁详情列表 + List rentalCostList = iwsCostPushMapper.getSafetyRentalCostList(proIdsBean); + + // 获取丢失详情列表 + proIdsBean.setType("2"); + + List lostCostList = iwsCostPushMapper.getSafetyBalanceCostList(proIdsBean); + + // 获取报废详情列表 + proIdsBean.setType("4"); + List scrapCostList = iwsCostPushMapper.getSafetyBalanceCostList(proIdsBean); + list.addAll(rentalCostList); + list.addAll(lostCostList); + list.addAll(scrapCostList); + + return list; + } + + /** + * 安全工机具分段推送 + * + */ + private void forHttpYouerSafety(List list,IwsCostPushBean proIdsBean) { + System.err.println("list-=========:" + list.toString()); + String content = JSONObject.toJSONString(list); + String encrypt; + try { + // 数据推送,http请求 + encrypt = AesEncryptUtils.encrypt(content, HttpHelper.KEY); + System.err.println("租赁费、维修费用、报废费推送数据解密======:" + AesEncryptUtils.decrypt(encrypt, HttpHelper.KEY)); + Map map = new HashMap(); + map.put("body", encrypt); + String body = JSONObject.toJSONString(map); + String url = "http://10.138.55.64:8036/micro-server/zzaqgjf/syncSafetyTool"; + // String url = "http://10.138.55.105:8097/micro-server/zzaqgjf/syncSafetyTool"; +// String url = "http://192.168.1.121:8036/micro-server/zzaqgjf/syncSafetyTool"; + String data = HttpHelper.sendHttpPost(url, body); + JSONObject object = JSONObject.parseObject(data); + System.err.println(data); + + list = resultDataHandler(data, list,proIdsBean); + // 创建数据更新参数 + IwsCostPushBean pushBean = new IwsCostPushBean(); + // 推送完成,循环更新本次审核的数据 + for (int i = 0; i < list.size(); i++) { + // 获取单个数据 + IwsCostPushBean bean = list.get(i); + String pushStatus = "0"; + String pushStatuString = bean.getPushStatus(); + if (StringHelper.isEmpty(pushStatuString)) { + pushStatus = "1"; + } else { + pushStatus = pushStatuString; + } + pushBean.setPushStatus(pushStatus); + pushBean.setPushRemark(bean.getPushRemark()); + pushBean.setPushTime(DateTimeHelper.getNowTime()); + pushBean.setId(bean.getId()); + // 获取费用类型 + String type = bean.getType(); + if ("1".equals(type)) { + // 判断是租赁费用,更新租赁费用数据 + iwsCostPushMapper.updatePushProjectInfo(pushBean); + } else { + iwsCostPushMapper.updatePushBsd(pushBean); + } + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + + + /** + * 安全工机具(消费性)费用推送 + * + */ + @Override + public AjaxResult safetyConsumeMaterialCostPush(IwsCostPushBean costDto) { + List proIdsBeans = new ArrayList<>(); + if(costDto.getAgreementIds().length>0){ + // 将协议合并成工程 + proIdsBeans = iwsCostPushMapper.getProIdsByAgreementIds(costDto.getAgreementIds()); + String month = iwsCostPushMapper.getMonth(costDto); + //获取费用列表 + for (IwsCostPushBean proIdsBean : proIdsBeans) { + proIdsBean.setUserName(SecurityUtils.getLoginUser().getSysUser().getUserName()); + proIdsBean.setSubmitUser(SecurityUtils.getLoginUser().getSysUser().getNickName()); + proIdsBean.setTaskId(costDto.getTaskId()); + proIdsBean.setMonth(month); + List list = getSafetyConsumeMonthCosts(proIdsBean); + if(CollectionUtils.isNotEmpty(list)){ + //分段推送 + forHttpYouerSafetyConsume(list,proIdsBean); + + } + } + } + return AjaxResult.success(proIdsBeans); + + } + + public List getSafetyConsumeMonthCosts(IwsCostPushBean proIdsBean){ + List list = new ArrayList<>(); + //确定各个工程下的协议有哪些 + proIdsBean.setAgreementIds(proIdsBean.getAgreementIdsStr().split( ",")); + proIdsBean.setType("1"); + proIdsBean.setSettlementType(2); + proIdsBean.setComsumeType(1); + // 获取租赁详情列表 + List rentalCostList = iwsCostPushMapper.getSafetyConsumeCostList(proIdsBean); + + + list.addAll(rentalCostList); + + + return list; + } + + + /** + * 安全工机具(消费性)分段推送 + * + */ + private void forHttpYouerSafetyConsume(List list,IwsCostPushBean proIdsBean) { + System.err.println("list-=========:" + list.toString()); + String content = JSONObject.toJSONString(list); + String encrypt; + try { + // 数据推送,http请求 + encrypt = AesEncryptUtils.encrypt(content, HttpHelper.KEY); + System.err.println("租赁费、维修费用、报废费推送数据解密======:" + AesEncryptUtils.decrypt(encrypt, HttpHelper.KEY)); + Map map = new HashMap(); + map.put("body", encrypt); + String body = JSONObject.toJSONString(map); + String url = "http://10.138.55.64:8036/micro-server/consumetool/syncConsumeTool"; + // String url = "http://10.138.55.105:8097/micro-server/zzaqgjf/syncSafetyTool"; +// String url = "http://192.168.1.121:8036/micro-server/zzaqgjf/syncSafetyTool"; + String data = HttpHelper.sendHttpPost(url, body); + JSONObject object = JSONObject.parseObject(data); + System.err.println(data); + + list = resultDataHandler(data, list,proIdsBean); + // 创建数据更新参数 + IwsCostPushBean pushBean = new IwsCostPushBean(); + // 推送完成,循环更新本次审核的数据 + for (int i = 0; i < list.size(); i++) { + // 获取单个数据 + IwsCostPushBean bean = list.get(i); + String pushStatus = "0"; + String pushStatuString = bean.getPushStatus(); + if (StringHelper.isEmpty(pushStatuString)) { + pushStatus = "1"; + } else { + pushStatus = pushStatuString; + } + pushBean.setPushStatus(pushStatus); + pushBean.setPushRemark(bean.getPushRemark()); + pushBean.setPushTime(DateTimeHelper.getNowTime()); + pushBean.setId(bean.getId()); + // 获取费用类型 + String type = bean.getType(); + if ("1".equals(type)) { + // 判断是租赁费用,更新租赁费用数据 + iwsCostPushMapper.updatePushProjectInfo(pushBean); + } else { + iwsCostPushMapper.updatePushBsd(pushBean); + } + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/task/IwsCostPushTask.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/task/IwsCostPushTask.java index a0d126bc..57a1a887 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/task/IwsCostPushTask.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/task/IwsCostPushTask.java @@ -24,6 +24,8 @@ public class IwsCostPushTask { /** * 定时任务 -- 计算月结费用 -- 每月最后一天的23点30分执行 */ +// @Scheduled(cron = "0 30 23 L * ?") +// @Scheduled(cron = "0 03 10 * * ?") @Scheduled(cron = "0 30 23 L * ?") public void computeTheMonthCostTask() { System.out.println("-----------开始计算四类未结算费用定时器-----------"); @@ -32,4 +34,6 @@ public class IwsCostPushTask { } + + } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialLeaseInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialLeaseInfoMapper.xml index a426f02c..0525a7b3 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialLeaseInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialLeaseInfoMapper.xml @@ -469,7 +469,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" bp.external_id AS externalId, bu.bzz_idcard AS idCard, bp.imp_unit AS impUnit, - lai.remark as remark + lai.remark as remark, + CASE + WHEN MAX(IFNULL(lad.is_update, 0)) = 1 THEN 1 + ELSE 0 + END as isUpdate from lease_apply_info lai left join tm_task tt on lai.task_id = tt.task_id @@ -1120,7 +1124,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" bp.external_id AS externalId, bu.bzz_idcard AS idCard, bp.imp_unit AS impUnit, - lpd.remark as remark + lpd.remark as remark, + CASE + WHEN MAX(IFNULL(lpd.is_update, 0)) = 1 THEN 1 + ELSE 0 + END as isUpdate FROM lease_publish_details lpd LEFT JOIN lease_apply_info lai ON lai.id = lpd.parent_id diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/push/IwsCostPushMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/push/IwsCostPushMapper.xml index 3473de0c..79b7db80 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/push/IwsCostPushMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/push/IwsCostPushMapper.xml @@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" pmc.id AS id, pmc.AGREEMENT_ID AS agreementId, IF(ISNULL(pmc.check_status), 0, pmc.check_status) AS checkStatus, pmc.LEASE_MONEY AS leaseMoney, pmc.LOST_MONEY AS lostMoney, pmc.REPAIR_MONEY AS repairMoney, pmc.SCRAP_MONEY AS scrapMoney, bma.agreement_code AS agreementCode, bma.is_slt AS isSettlement, pmc.TYPE AS settlementType, - bp.pro_name AS projectName, bu.unit_name AS unitName, + bp.pro_name AS projectName, bu.unit_name AS unitName,cpm.id as taskId, ROUND( SUM(ifnull( pmc.LEASE_MONEY, 0 )+ ifnull( pmc.LOST_MONEY, 0 )+ ifnull( pmc.REPAIR_MONEY, 0 )+ ifnull( pmc.SCRAP_MONEY, 0 )), 2 ) AS money @@ -57,6 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN bm_project bp ON bp.pro_id = bma.project_id LEFT JOIN bm_unit bu ON bu.unit_id = bma.unit_id WHERE + pmc.type = 1 and ( pmc.LEASE_MONEY > 0 OR pmc.LOST_MONEY > 0 OR pmc.REPAIR_MONEY > 0 OR pmc.SCRAP_MONEY > 0 ) AND pmc.check_status = #{checkStatus} @@ -444,5 +445,265 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + UPDATE project_month_costs SET check_status = 1, check_time = now(),check_user = #{userName} + WHERE task_id = #{taskId} + and agreement_id in + + #{item} + + + and type = #{settlementType} + + + and type = #{settlementType} and (consume_money = 0 || consume_money is null) + + + and type = #{settlementType} and consume_money > 0 + + + + UPDATE project_month_info SET push_status = #{pushStatus}, push_time = #{pushTime}, push_remark = #{pushRemark} + WHERE id = #{id} + + + UPDATE slt_agreement_details SET push_status = #{pushStatus}, push_time = #{pushTime}, push_remark = #{pushRemark} + WHERE id = #{id} + + + UPDATE project_month_info SET push_status = 2, push_remark = #{pushRemark} + WHERE id = #{id} + + + UPDATE slt_agreement_details SET push_status = 2, push_remark = #{pushRemark} + WHERE id = #{id} + + + + + + diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/push/MybatisGenerator.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/push/MybatisGenerator.xml index 1916b107..ebc1d22f 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/push/MybatisGenerator.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/push/MybatisGenerator.xml @@ -9,6 +9,7 @@ select pmc.id , pmc.task_id as taskId, + pmc.agreement_id AS agreementId, bu.unit_name as unitName, bai.unit_id as unitId, bp.pro_name as projectName, @@ -42,11 +43,12 @@ LEFT JOIN bm_agreement_info bai ON pmi.agreementId = bai.agreement_id LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id LEFT JOIN calc_project_month cpm ON pmi.taskId = cpm.ID + where pmi.jiju_type = 2 GROUP BY pmi.agreementId ) pmia on bai.project_id = pmia.project_id and pmc.task_id=pmia.taskId and pmia.agreementId=pmc.AGREEMENT_ID where - bp.pro_id is not null + bp.pro_id is not null and pmc.type = 2 and (pmc.LEASE_MONEY > 0 or pmc.LOST_MONEY > 0 or pmc.REPAIR_MONEY > 0 or pmc.SCRAP_MONEY > 0) @@ -70,46 +72,56 @@ SELECT pmc.id, pmc.task_id AS taskId, + pmc.agreement_id AS agreementId, bu.unit_name AS unitName, bai.unit_id AS unitId, bp.pro_name AS projectName, bp.pro_id AS projectId, bp.pro_code AS proCode, cpm.`MONTH`, - pmc.LEASE_MONEY AS leaseMoney, - pmc.LOST_MONEY AS lostMoney, - pmc.SCRAP_MONEY AS scrapMoney, - pmc.REPAIR_MONEY AS repairMoney, pmia.push_status AS pushStatus, pmia.push_remark AS pushRemark, - ROUND( ifnull( pmc.LEASE_MONEY, 0 )+ ifnull( pmc.LOST_MONEY, 0 )+ ifnull( pmc.SCRAP_MONEY, 0 ), 2 ) AS money, + ifnull( pmc.CONSUME_MONEY, 0 ) AS leaseMoney, pmc.CHECK_STATUS AS checkStatus - FROM + FROM project_month_costs pmc LEFT JOIN bm_agreement_info bai ON bai.agreement_id = pmc.AGREEMENT_ID LEFT JOIN calc_project_month cpm ON pmc.task_id = cpm.id LEFT JOIN bm_unit bu ON bu.unit_id = bai.unit_id LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id LEFT JOIN ( - SELECT - pmi.type, - pmi.agreementId, - pmi.taskId, - pmi.push_status, - pmi.push_remark, - bai.unit_id, - bai.project_id - FROM - project_month_info pmi - LEFT JOIN bm_agreement_info bai ON pmi.agreementId = bai.agreement_id - LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id - LEFT JOIN calc_project_month cpm ON pmi.taskId = cpm.ID - GROUP BY - pmi.agreementId - ) pmia ON bai.project_id = pmia.project_id AND pmc.task_id = pmia.taskId AND pmia.agreementId = pmc.AGREEMENT_ID + SELECT + pmi.type, + pmi.agreementId, + pmi.taskId, + pmi.push_status, + pmi.push_remark, + bai.unit_id, + bai.project_id + FROM + project_month_info pmi + LEFT JOIN bm_agreement_info bai ON pmi.agreementId = bai.agreement_id + LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id + LEFT JOIN calc_project_month cpm ON pmi.taskId = cpm.ID + where pmi.jiju_type = 2 + GROUP BY + pmi.agreementId + ) pmia ON bai.project_id = pmia.project_id AND pmc.task_id = pmia.taskId AND pmia.agreementId = pmc.AGREEMENT_ID WHERE - bp.pro_id IS NOT NULL - AND ( pmc.LEASE_MONEY > 0 OR pmc.LOST_MONEY > 0 OR pmc.REPAIR_MONEY > 0 OR pmc.SCRAP_MONEY > 0 ) + bp.pro_id IS NOT NULL and pmc.type = 2 + and pmc.CONSUME_MONEY>0 + + AND pmia.push_status = #{status} + + + AND cpm.month = #{month} + + + AND bp.pro_id = #{projectId} + + + AND bu.unit_id = #{unitId} + GROUP BY bai.project_id, bai.unit_id ORDER BY