新增费用推送审核功能及AES加密工具类
This commit is contained in:
parent
f0b250ae0d
commit
a6639b8210
|
|
@ -0,0 +1,85 @@
|
|||
package com.bonus.common.biz.utils;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.KeyGenerator;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author : 阮世耀
|
||||
* @version : 1.0
|
||||
* @PackagePath: com.bonus.common.biz.utils
|
||||
* @CreateTime: 2025-06-29 14:36
|
||||
* @Description: 前后端数据传输加密工具类
|
||||
*/
|
||||
public class AesEncryptUtils {
|
||||
|
||||
//可配置到Constant中,并读取配置文件注入,16位,自己定义
|
||||
private static final String KEY = "$jqgcYouote@c103";
|
||||
|
||||
//参数分别代表 算法名称/加密模式/数据填充方式
|
||||
private static final String ALGORITHMSTR = "AES/ECB/PKCS5Padding";
|
||||
|
||||
/**
|
||||
* 加密
|
||||
* @param content 加密的字符串
|
||||
* @param encryptKey key值
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String encrypt(String content, String encryptKey) throws Exception {
|
||||
KeyGenerator kgen = KeyGenerator.getInstance("AES");
|
||||
kgen.init(128);
|
||||
Cipher cipher = Cipher.getInstance(ALGORITHMSTR);
|
||||
cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(encryptKey.getBytes(), "AES"));
|
||||
byte[] b = cipher.doFinal(content.getBytes(StandardCharsets.UTF_8));
|
||||
// 采用base64算法进行转码,避免出现中文乱码
|
||||
return Base64.encodeBase64String(b);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密
|
||||
* @param encryptStr 解密的字符串
|
||||
* @param decryptKey 解密的key值
|
||||
*/
|
||||
public static String decrypt(String encryptStr, String decryptKey) throws Exception {
|
||||
KeyGenerator kgen = KeyGenerator.getInstance("AES");
|
||||
kgen.init(128);
|
||||
Cipher cipher = Cipher.getInstance(ALGORITHMSTR);
|
||||
cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(decryptKey.getBytes(), "AES"));
|
||||
// 采用base64算法进行转码,避免出现中文乱码
|
||||
byte[] encryptBytes = Base64.decodeBase64(encryptStr);
|
||||
byte[] decryptBytes = cipher.doFinal(encryptBytes);
|
||||
return new String(decryptBytes);
|
||||
}
|
||||
|
||||
public static String encrypt(String content) throws Exception {
|
||||
return encrypt(content, KEY);
|
||||
}
|
||||
|
||||
public static String decrypt(String encryptStr) throws Exception {
|
||||
return decrypt(encryptStr, KEY);
|
||||
}
|
||||
|
||||
|
||||
// public static void main(String[] args) throws Exception {
|
||||
// Map<String, String> map=new HashMap<>();
|
||||
// map.put("key","value");
|
||||
// map.put("中文","汉字");
|
||||
// String content = JSONObject.toJSONString(map);
|
||||
// System.out.println("加密前:" + content);
|
||||
//
|
||||
// String encrypt = encrypt(content, KEY);
|
||||
// System.out.println("加密后:" + encrypt);
|
||||
//
|
||||
//
|
||||
//
|
||||
// String decrypt = decrypt(encrypt);
|
||||
// System.out.println("解密后:" + decrypt);
|
||||
// }
|
||||
}
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
package com.bonus.common.biz.utils;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
|
|
@ -15,11 +13,14 @@ 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
|
||||
*/
|
||||
public class HttpHelper {
|
||||
|
||||
public static final String KEY = "$jqgcYouote@c103";
|
||||
|
||||
public static String sendHttpPost(String url, String JSONBody) throws Exception {
|
||||
System.out.println("JSONBody-=========:" + JSONBody);
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,222 @@
|
|||
package com.bonus.material.push.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.nacos.common.utils.StringUtils;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.material.push.domain.CostPushBean;
|
||||
import com.bonus.material.push.service.CostPushService;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author : 阮世耀
|
||||
* @version : 1.0
|
||||
* @PackagePath: com.bonus.material.push.controller
|
||||
* @CreateTime: 2025-06-29 13:57
|
||||
* @Description: 描述
|
||||
*/
|
||||
@RequestMapping("/backstage/costPush/")
|
||||
@RestController
|
||||
public class CostPushController extends BaseController {
|
||||
|
||||
private static final String KEY = "$jqgcYouote@c103";
|
||||
|
||||
@Autowired
|
||||
private CostPushService service;
|
||||
|
||||
/**
|
||||
* 查询费用推送审核--列表
|
||||
*/
|
||||
@RequestMapping(value = "getCostPushCheckList", method = RequestMethod.GET)
|
||||
public TableDataInfo getCostPushCheckList(CostPushBean o) {
|
||||
try {
|
||||
List<CostPushBean> results = service.getCostPushCheckList(o);
|
||||
return getDataTable(results);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
throw new ServiceException("数据查询异常,请联系运维人员查询日志处理");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询费用推送审核--合计
|
||||
*/
|
||||
@RequestMapping(value = "getCostPushCheckListCount", method = RequestMethod.GET)
|
||||
public AjaxResult getCostPushCheckListCount(CostPushBean o) {
|
||||
try {
|
||||
CostPushBean results = service.getCostPushCheckListCount(o);
|
||||
return success(results);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
throw new ServiceException("数据查询异常,请联系运维人员查询日志处理");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询消耗费用推送审核--列表
|
||||
*/
|
||||
@RequestMapping(value = "getConsumPushCheckList", method = RequestMethod.GET)
|
||||
public TableDataInfo getConsumPushCheckList(CostPushBean o) {
|
||||
try {
|
||||
List<CostPushBean> results = service.getConsumPushCheckList(o);
|
||||
return getDataTable(results);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
throw new ServiceException("数据查询异常,请联系运维人员查询日志处理");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询消耗费用推送审核--合计
|
||||
*/
|
||||
@RequestMapping(value = "getConsumPushCheckListCount", method = RequestMethod.GET)
|
||||
public AjaxResult getConsumPushCheckListCount(CostPushBean o) {
|
||||
try {
|
||||
CostPushBean results = service.getConsumPushCheckListCount(o);
|
||||
return success(results);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
throw new ServiceException("数据查询异常,请联系运维人员查询日志处理");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核选中的数据
|
||||
*/
|
||||
@RequestMapping(value = "checkData", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public AjaxResult checkData(String chks) {
|
||||
try {
|
||||
int res = createParams(chks,"1");
|
||||
if (res > 0) {
|
||||
new Thread(() -> service.pushDataToYouer(chks)).start();
|
||||
}
|
||||
return success("审核成功");
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
throw new ServiceException("数据查询异常,请联系运维人员查询日志处理");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 消耗性费用审核选中的数据
|
||||
*/
|
||||
@RequestMapping(value = "consumeCheckData", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public AjaxResult consumeCheckData(String chks) {
|
||||
try {
|
||||
int res = createParams(chks,"2");
|
||||
if (res > 0) {
|
||||
new Thread(() -> service.pushConsumeDataToYouer(chks)).start();
|
||||
}
|
||||
return success("审核成功");
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
throw new ServiceException("数据查询异常,请联系运维人员查询日志处理");
|
||||
}
|
||||
}
|
||||
|
||||
private int createParams(String cheks,String type) {
|
||||
int res = 0;
|
||||
if (StringUtils.isNotEmpty(cheks)) {
|
||||
JSONArray object = JSONObject.parseArray(cheks);
|
||||
if (object != null && !object.isEmpty()) {
|
||||
for (int i = 0; i < object.size(); i++) {
|
||||
CostPushBean bean = new CostPushBean();
|
||||
JSONObject idObj = object.getJSONObject(i);
|
||||
String proId = idObj.getString("projectId");
|
||||
String taskId = idObj.getString("taskId");
|
||||
String unitId = idObj.getString("unitId");
|
||||
bean.setTaskId(taskId);
|
||||
bean.setProjectId(proId);
|
||||
bean.setUnitId(unitId);
|
||||
if("1".equals(type)){
|
||||
res = service.updatePushAQStatus(bean);
|
||||
}
|
||||
if("2".equals(type)){
|
||||
res = service.updatePushXHStatus(bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 费用审核导出
|
||||
*/
|
||||
@RequestMapping("exportPushCheck")
|
||||
public void exportPushCheck(HttpServletResponse response, CostPushBean o) {
|
||||
try {
|
||||
String month = o.getMonth();
|
||||
if (StringUtils.isBlank(month)) {
|
||||
month = DateUtils.getCurrentMonth();
|
||||
}
|
||||
List<CostPushBean> results = service.getCostPushCheckList(o);
|
||||
ExcelUtil<CostPushBean> excelUtil = new ExcelUtil<>(CostPushBean.class);
|
||||
excelUtil.exportExcel(response, results, "费用推送审核表" + month + "月份");
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 消耗品费用审核导出
|
||||
*/
|
||||
@RequestMapping("exportConsPushCheck")
|
||||
public void exportConsPushCheck(HttpServletResponse response, CostPushBean o) {
|
||||
try {
|
||||
String month = o.getMonth();
|
||||
if (StringUtils.isBlank(month)) {
|
||||
month = DateUtils.getCurrentMonth();
|
||||
}
|
||||
List<CostPushBean> results = service.getConsumPushCheckList(o);
|
||||
ExcelUtil<CostPushBean> excelUtil = new ExcelUtil<>(CostPushBean.class);
|
||||
excelUtil.exportExcel(response, results, "消耗品费用推送审核表" + month + "月份");
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "findDetails", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public TableDataInfo findDetails(CostPushBean o) {
|
||||
try {
|
||||
List<CostPushBean> results = service.findDetails(o);
|
||||
return getDataTable(results);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
return getDataTable(Collections.emptyList());
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "findOtherDetails", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public TableDataInfo findOtherDetails(CostPushBean o) {
|
||||
try {
|
||||
List<CostPushBean> results = service.findOtherDetails(o);
|
||||
return getDataTable(results);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
return getDataTable(Collections.emptyList());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
package com.bonus.material.push.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.ibatis.type.Alias;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 消耗品费用推送实体类 描述:
|
||||
*
|
||||
* @table:
|
||||
* @author lvjilong
|
||||
* @date 2024年5月23日
|
||||
*/
|
||||
@Data
|
||||
@Alias("ConsumeDataPush")
|
||||
public class ConsumeDataPush implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 工程ID
|
||||
*/
|
||||
private String projectId;
|
||||
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 领用单位
|
||||
*/
|
||||
private String unitName;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 类型(规格)
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 领用数量
|
||||
*/
|
||||
private String quantity;
|
||||
|
||||
/**
|
||||
* 购置价(不含税)
|
||||
*/
|
||||
private String netPrice;
|
||||
|
||||
/**
|
||||
* 费用
|
||||
*/
|
||||
private String cost;
|
||||
/**
|
||||
* 费用月份
|
||||
*/
|
||||
private String expenseTime;
|
||||
|
||||
private String submitUser;
|
||||
|
||||
/**
|
||||
* 推送月份
|
||||
*/
|
||||
private String month;
|
||||
|
||||
private String body;
|
||||
|
||||
private String pushStatus;
|
||||
|
||||
private String pushRemark;
|
||||
|
||||
/**
|
||||
* 系统标识 1代表机具系统 2代表机具物资 3代表送变电物资系统
|
||||
*/
|
||||
private String sysType="2";
|
||||
|
||||
/**
|
||||
* i8工程编号
|
||||
*/
|
||||
private String pc_no;
|
||||
|
||||
public void setUnit(String unitName) {
|
||||
this.unitName = unitName;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
package com.bonus.material.push.domain;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.apache.ibatis.type.Alias;
|
||||
|
||||
/**
|
||||
* @author : 阮世耀
|
||||
* @version : 1.0
|
||||
* @PackagePath: com.bonus.material.push.domain
|
||||
* @CreateTime: 2025-06-29 14:03
|
||||
* @Description: 描述
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
@Alias("CostPushBean")
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CostPushBean implements java.io.Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String id;
|
||||
|
||||
private String projectId;
|
||||
|
||||
private String unitId;
|
||||
|
||||
@Excel(name = "工程名称", sort = 1)
|
||||
private String projectName;
|
||||
|
||||
@Excel(name = "单位名称", sort = 2)
|
||||
private String unitName;
|
||||
|
||||
private String typeName;
|
||||
|
||||
private String modelName;
|
||||
|
||||
private String num;
|
||||
|
||||
private String leaseDate;
|
||||
|
||||
private String backDate;
|
||||
|
||||
private String leaseMoney;
|
||||
|
||||
@Excel(name = "丢失费用", sort = 7)
|
||||
private String lostMoney;
|
||||
|
||||
@Excel(name = "报废费用", sort = 8)
|
||||
private String scrapMoney;
|
||||
|
||||
private String repairMoney;
|
||||
|
||||
@Excel(name = "消耗品费用", sort = 9)
|
||||
private String consMoney;
|
||||
|
||||
@Excel(name = "租赁费用", sort = 6)
|
||||
private String leasePrice;
|
||||
|
||||
private String time;
|
||||
|
||||
@Excel(name = "推送月份", sort = 4)
|
||||
private String month;
|
||||
|
||||
private String type;
|
||||
|
||||
private String buyPrice;
|
||||
|
||||
private String isPush;
|
||||
|
||||
private String money;
|
||||
|
||||
private String year;
|
||||
|
||||
private String taskId;
|
||||
|
||||
private String proCode;
|
||||
|
||||
private String dayNum;
|
||||
|
||||
/**
|
||||
* 类别编号(周转安全工器具-2or周转工器具-1
|
||||
*/
|
||||
private String category = "2";
|
||||
|
||||
/**
|
||||
* i8工程编号
|
||||
*/
|
||||
@Excel(name = "i8工程编号", sort = 3)
|
||||
private String pc_no;
|
||||
|
||||
/**
|
||||
* 系统标识 1代表机具系统 2代表机具物资 3代表送变电物资系统
|
||||
*/
|
||||
private String sysType = "2";
|
||||
|
||||
/**
|
||||
* 提交人
|
||||
*/
|
||||
private String submitUser;
|
||||
|
||||
private String body;
|
||||
|
||||
private String pushStatus = "1";
|
||||
|
||||
private String pushRemark;
|
||||
|
||||
/**
|
||||
* 审核状态0 未审核 1已审核
|
||||
*/
|
||||
@Excel(name = "是否审核", sort = 5, readConverterExp = "0=未审核,1=已审核")
|
||||
private int checkStatus;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package com.bonus.material.push.mapper;
|
||||
|
||||
import com.bonus.material.push.domain.ConsumeDataPush;
|
||||
import com.bonus.material.push.domain.CostPushBean;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : 阮世耀
|
||||
* @version : 1.0
|
||||
* @PackagePath: com.bonus.material.push.mapper
|
||||
* @CreateTime: 2025-06-29 14:42
|
||||
* @Description: 描述
|
||||
*/
|
||||
@Mapper
|
||||
public interface CostPushMapper {
|
||||
|
||||
/**
|
||||
* 获取费用推送审核数据
|
||||
* @author 吕继龙
|
||||
*/
|
||||
List<CostPushBean> getCostPushCheckList(CostPushBean o);
|
||||
|
||||
/**
|
||||
* 获取消耗费用推送审核数据
|
||||
* @author 吕继龙
|
||||
*/
|
||||
List<CostPushBean> getConsumePushCheckList(CostPushBean o);
|
||||
|
||||
/**
|
||||
* 更新审核状态
|
||||
*/
|
||||
void updateCostPushCheckStatus(String id);
|
||||
|
||||
/**
|
||||
* 更新提交推送状态
|
||||
*/
|
||||
void updateCostPushStatus(CostPushBean o);
|
||||
|
||||
/**
|
||||
* 获取消耗品费用集合
|
||||
* @return List<ConsumeDataPush>
|
||||
*/
|
||||
List<ConsumeDataPush> getConsumeDataPushsList(CostPushBean o);
|
||||
|
||||
/**
|
||||
* 获取推送费用数据
|
||||
* @return List<CostPushBean>
|
||||
*/
|
||||
List<CostPushBean> getToolDataPushList(CostPushBean o);
|
||||
|
||||
List<CostPushBean> findDetails(CostPushBean o);
|
||||
|
||||
List<CostPushBean> findOtherDetails(CostPushBean o);
|
||||
|
||||
int updatePushAQStatus(CostPushBean bean);
|
||||
|
||||
int updatePushXHStatus(CostPushBean bean);
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
package com.bonus.material.push.service;
|
||||
|
||||
import com.bonus.material.push.domain.CostPushBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : 阮世耀
|
||||
* @version : 1.0
|
||||
* @PackagePath: com.bonus.material.push.service
|
||||
* @CreateTime: 2025-06-29 14:16
|
||||
* @Description: 描述
|
||||
*/
|
||||
public interface CostPushService {
|
||||
|
||||
/**
|
||||
* 获取费用推送审核数据
|
||||
*/
|
||||
List<CostPushBean> getCostPushCheckList(CostPushBean o);
|
||||
|
||||
/**
|
||||
* 获取费用推送审核数据
|
||||
*/
|
||||
CostPushBean getCostPushCheckListCount(CostPushBean o);
|
||||
|
||||
/**
|
||||
* 获取消耗费用推送审核数据
|
||||
*/
|
||||
List<CostPushBean> getConsumPushCheckList(CostPushBean o);
|
||||
|
||||
CostPushBean getConsumPushCheckListCount(CostPushBean o);
|
||||
|
||||
|
||||
List<CostPushBean> findDetails(CostPushBean o);
|
||||
|
||||
List<CostPushBean> findOtherDetails(CostPushBean o);
|
||||
|
||||
|
||||
/**
|
||||
* 推送数据到优尔
|
||||
*/
|
||||
void pushDataToYouer(String cheks);
|
||||
|
||||
/**
|
||||
* 消耗性费用推送数据到优尔
|
||||
*/
|
||||
void pushConsumeDataToYouer(String cheks);
|
||||
|
||||
/**
|
||||
* 更新安全状态
|
||||
*/
|
||||
int updatePushAQStatus(CostPushBean bean);
|
||||
|
||||
/**
|
||||
* 更新消耗品状态
|
||||
*/
|
||||
int updatePushXHStatus(CostPushBean bean);
|
||||
}
|
||||
|
|
@ -0,0 +1,429 @@
|
|||
package com.bonus.material.push.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.nacos.common.utils.StringUtils;
|
||||
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.security.utils.SecurityUtils;
|
||||
import com.bonus.material.push.domain.ConsumeDataPush;
|
||||
import com.bonus.material.push.domain.CostPushBean;
|
||||
import com.bonus.material.push.mapper.CostPushMapper;
|
||||
import com.bonus.material.push.service.CostPushService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author : 阮世耀
|
||||
* @version : 1.0
|
||||
* @PackagePath: com.bonus.material.push.service.impl
|
||||
* @CreateTime: 2025-06-29 14:16
|
||||
* @Description:
|
||||
*/
|
||||
@Service
|
||||
public class CostPushServiceImpl implements CostPushService {
|
||||
|
||||
@Autowired
|
||||
private CostPushMapper dao;
|
||||
|
||||
/**
|
||||
* 获取费用推送审核数据
|
||||
*/
|
||||
@Override
|
||||
public List<CostPushBean> getCostPushCheckList(CostPushBean o) {
|
||||
// TODO Auto-generated method stub
|
||||
return dao.getCostPushCheckList(o);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取费用推送审核数据
|
||||
*/
|
||||
@Override
|
||||
public CostPushBean getCostPushCheckListCount(CostPushBean o) {
|
||||
// TODO Auto-generated method stub
|
||||
List<CostPushBean> beanList = dao.getCostPushCheckList(o);
|
||||
calcTotalMoney(beanList);
|
||||
return beanList.get(beanList.size() - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取消耗费用推送审核数据
|
||||
*/
|
||||
@Override
|
||||
public List<CostPushBean> getConsumPushCheckList(CostPushBean o) {
|
||||
// TODO Auto-generated method stub
|
||||
return dao.getConsumePushCheckList(o);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取消耗费用推送数据统计
|
||||
*/
|
||||
@Override
|
||||
public CostPushBean getConsumPushCheckListCount(CostPushBean o) {
|
||||
// TODO Auto-generated method stub
|
||||
List<CostPushBean> list = dao.getConsumePushCheckList(o);
|
||||
if (list.isEmpty()) {
|
||||
return new CostPushBean();
|
||||
}
|
||||
calcTotalMoney(list);
|
||||
return list.get(list.size() - 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CostPushBean> findDetails(CostPushBean o) {
|
||||
List<CostPushBean> list = dao.findDetails(o);
|
||||
if (list == null || list.size() <= 0) {
|
||||
return list;
|
||||
} else {
|
||||
double total = 0;
|
||||
for (CostPushBean bean : list) {
|
||||
String leaseMoney = bean.getLeaseMoney();
|
||||
total += moneyStringToDouble(leaseMoney);
|
||||
}
|
||||
CostPushBean newBean = new CostPushBean();
|
||||
newBean.setLeaseMoney(String.format("%.2f", total));
|
||||
newBean.setProjectName("合计费用");
|
||||
list.add(newBean);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CostPushBean> findOtherDetails(CostPushBean o) {
|
||||
return dao.findOtherDetails(o);
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送数据到优尔
|
||||
*/
|
||||
@Override
|
||||
public void pushDataToYouer(String cheks) {
|
||||
// 对参数进行处理
|
||||
List<CostPushBean> params = createParams(cheks);
|
||||
//根据ProjectId进行工程分组
|
||||
Map<String, List<CostPushBean>> groupedByProjectId = params.stream()
|
||||
.collect(Collectors.groupingBy(CostPushBean::getProjectId));
|
||||
//取出工程分组后的集合
|
||||
List<List<CostPushBean>> projectList = new ArrayList<>(groupedByProjectId.values());
|
||||
if (!projectList.isEmpty()) {
|
||||
for (List<CostPushBean> bean : projectList) {
|
||||
for (CostPushBean costPushBean : bean) {
|
||||
dao.updateCostPushCheckStatus(costPushBean.getId());
|
||||
}
|
||||
pushToolData(bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 消耗性费用推送数据到优尔
|
||||
*/
|
||||
@Override
|
||||
public void pushConsumeDataToYouer(String cheks) {
|
||||
// 对参数进行处理
|
||||
List<CostPushBean> params = createParams(cheks);
|
||||
//根据ProjectId进行工程分组
|
||||
Map<String, List<CostPushBean>> groupedByProjectId = params.stream()
|
||||
.collect(Collectors.groupingBy(CostPushBean::getProjectId));
|
||||
//取出工程分组后的集合
|
||||
List<List<CostPushBean>> projectList = new ArrayList<>(groupedByProjectId.values());
|
||||
if (!projectList.isEmpty()) {
|
||||
for (List<CostPushBean> bean : projectList) {
|
||||
for (CostPushBean costPushBean : bean) {
|
||||
dao.updateCostPushCheckStatus(costPushBean.getId());
|
||||
}
|
||||
pushConsumeData(bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新安全状态
|
||||
*/
|
||||
@Override
|
||||
public int updatePushAQStatus(CostPushBean bean) {
|
||||
return dao.updatePushAQStatus(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新消耗品状态
|
||||
*/
|
||||
@Override
|
||||
public int updatePushXHStatus(CostPushBean bean) {
|
||||
return dao.updatePushXHStatus(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 费用判断转换,从字符串转换到double类型
|
||||
*/
|
||||
private double moneyStringToDouble(String money) {
|
||||
if (StringUtils.isEmpty(money)) {
|
||||
return 0.00;
|
||||
} else {
|
||||
return Double.parseDouble(money);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算合计费用并添加到数据集合中
|
||||
*
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
private List<CostPushBean> calcTotalMoney(List<CostPushBean> list) {
|
||||
double leasatotal = 0;// 租赁总费用
|
||||
double losttotal = 0.00;// 丢失总费用
|
||||
double scraptotal = 0;// 报废总费用
|
||||
double consttotal = 0;// 维修总费用
|
||||
double moneytotal = 0;// 合计总费用
|
||||
|
||||
if (list != null && !list.isEmpty()) {
|
||||
for (CostPushBean bean : list) {
|
||||
String leaseMoney = bean.getLeaseMoney();
|
||||
String lostMoney = bean.getLostMoney();
|
||||
String scrapMoney = bean.getScrapMoney();
|
||||
String consMoney = bean.getConsMoney();
|
||||
String money = bean.getMoney();
|
||||
leasatotal += moneyStringToDouble(leaseMoney);
|
||||
losttotal += moneyStringToDouble(lostMoney);
|
||||
scraptotal += moneyStringToDouble(scrapMoney);
|
||||
consttotal += moneyStringToDouble(consMoney);
|
||||
moneytotal += moneyStringToDouble(money);
|
||||
}
|
||||
CostPushBean newBean = new CostPushBean();
|
||||
newBean.setLeaseMoney(String.format("%.2f", leasatotal));
|
||||
newBean.setLostMoney(String.format("%.2f", losttotal));
|
||||
newBean.setScrapMoney(String.format("%.2f", scraptotal));
|
||||
newBean.setConsMoney(String.format("%.2f", consttotal));
|
||||
newBean.setMoney(String.format("%.2f", moneytotal));
|
||||
newBean.setProjectName("合计费用");
|
||||
list.add(newBean);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将费用合计推送至优尔
|
||||
*/
|
||||
private void pushToolData(List<CostPushBean> params) {
|
||||
List<CostPushBean> list = getToolData(params);
|
||||
// 推送数据租赁费、维修费用、报废费用
|
||||
if (!list.isEmpty()) {
|
||||
httpToolData(list);
|
||||
for (CostPushBean bean : list) {
|
||||
// 更新推送状态
|
||||
bean.setTime(DateTimeHelper.getNowTime());
|
||||
dao.updateCostPushStatus(bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取要推送的租赁费用、维修费用、报废费用
|
||||
*/
|
||||
private List<CostPushBean> getToolData(List<CostPushBean> params) {
|
||||
List<CostPushBean> result = new ArrayList<>();
|
||||
String submitUser = SecurityUtils.getUsername();
|
||||
for (CostPushBean bean : params) {
|
||||
bean.setSubmitUser(submitUser);
|
||||
bean.setType("1");
|
||||
List<CostPushBean> leaseList = dao.getToolDataPushList(bean);
|
||||
if (leaseList != null && !leaseList.isEmpty()) {
|
||||
result.addAll(leaseList);
|
||||
}
|
||||
bean.setType("3");
|
||||
List<CostPushBean> scrapList = dao.getToolDataPushList(bean);
|
||||
if (scrapList != null && !scrapList.isEmpty()) {
|
||||
result.addAll(scrapList);
|
||||
}
|
||||
bean.setType("4");
|
||||
List<CostPushBean> lossList = dao.getToolDataPushList(bean);
|
||||
if (lossList != null && !lossList.isEmpty()) {
|
||||
result.addAll(lossList);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用接口推送 租赁费、维修费用、报废费用到优尔
|
||||
*/
|
||||
private List<CostPushBean> httpToolData(List<CostPushBean> list) {
|
||||
String content = JSONObject.toJSONString(list);
|
||||
String encrypt;
|
||||
try {
|
||||
// 数据推送,http请求
|
||||
encrypt = AesEncryptUtils.encrypt(content, HttpHelper.KEY);
|
||||
System.err.println("租赁费、维修费用、报废费推送数据解密======:" + AesEncryptUtils.decrypt(encrypt, HttpHelper.KEY));
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("body", encrypt);
|
||||
String body = JSONObject.toJSONString(map);
|
||||
String url = "http://10.138.55.105:8097/micro-server/zzaqgjf/syncSafetyTool";
|
||||
//String url = "http://192.168.1.134:8036/micro-server/zzaqgjf/syncSafetyTool";
|
||||
String data = HttpHelper.sendHttpPost(url, body);
|
||||
JSONObject object = JSONObject.parseObject(data);
|
||||
System.err.println(data);
|
||||
|
||||
|
||||
String code = object.getString("code");
|
||||
if ("200".equals(code)) {
|
||||
String dataResultString = object.getString("data");
|
||||
// 数据解密
|
||||
String dataArrayString = AesEncryptUtils.decrypt(dataResultString, HttpHelper.KEY);
|
||||
System.err.println("四类费用推送返回:"+dataArrayString);
|
||||
JSONArray dataArray = JSONArray.parseArray(dataArrayString);
|
||||
if (dataArray != null && !dataArray.isEmpty()) {
|
||||
// 有数据
|
||||
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++) {
|
||||
CostPushBean costPushBean = list.get(j);
|
||||
String id = costPushBean.getId();
|
||||
if (resultId.equals(id)) {
|
||||
costPushBean.setPushRemark(resultPushRemark);
|
||||
costPushBean.setPushStatus(pushStatus);
|
||||
list.set(j, costPushBean);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 构造 查询费用参数
|
||||
*/
|
||||
private List<CostPushBean> createParams(String cheks) {
|
||||
if (StringUtils.isNotEmpty(cheks)) {
|
||||
JSONArray object = JSONObject.parseArray(cheks);
|
||||
List<CostPushBean> params = new ArrayList<>();
|
||||
if (object != null && !object.isEmpty()) {
|
||||
for (int i = 0; i < object.size(); i++) {
|
||||
CostPushBean bean = new CostPushBean();
|
||||
JSONObject idObj = object.getJSONObject(i);
|
||||
String id = idObj.getString("id");
|
||||
String proId = idObj.getString("projectId");
|
||||
String taskId = idObj.getString("taskId");
|
||||
String unitId = idObj.getString("unitId");
|
||||
bean.setId(id);
|
||||
bean.setProjectId(proId);
|
||||
bean.setTaskId(taskId);
|
||||
bean.setUnitId(unitId);
|
||||
params.add(bean);
|
||||
}
|
||||
}
|
||||
return params;
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 将消耗性费用推送至优尔 主表: 关联表: 描述: TODO
|
||||
*/
|
||||
private void pushConsumeData(List<CostPushBean> params) {
|
||||
List<ConsumeDataPush> consumeList = getConsumeDataList(params);
|
||||
|
||||
// 推送消耗品费用到优尔
|
||||
if (!consumeList.isEmpty()) {
|
||||
httpConsumeData(consumeList);
|
||||
for (ConsumeDataPush bean : consumeList) {
|
||||
CostPushBean costPushBean = new CostPushBean();
|
||||
costPushBean.setTime(DateTimeHelper.getNowTime());
|
||||
costPushBean.setPushRemark(bean.getPushRemark());
|
||||
costPushBean.setPushStatus(bean.getPushStatus());
|
||||
costPushBean.setId(bean.getId());
|
||||
// 更新推送状态
|
||||
dao.updateCostPushStatus(costPushBean);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取消耗品推送费用集合 主表: 关联表: 描述: TODO
|
||||
*
|
||||
* @return List<ConsumeDataPush>
|
||||
*/
|
||||
private List<ConsumeDataPush> getConsumeDataList(List<CostPushBean> params) {
|
||||
List<ConsumeDataPush> result = new ArrayList<>();
|
||||
String submitUser = SecurityUtils.getUsername();
|
||||
for (CostPushBean bean : params) {
|
||||
bean.setSubmitUser(submitUser);
|
||||
List<ConsumeDataPush> tempList = dao.getConsumeDataPushsList(bean);
|
||||
result.addAll(tempList);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用接口推送 消耗品费用到优尔
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
private List<ConsumeDataPush> httpConsumeData(List<ConsumeDataPush> list) {
|
||||
String content = JSONObject.toJSONString(list);
|
||||
String encrypt;
|
||||
try {
|
||||
// 数据推送,http请求
|
||||
encrypt = AesEncryptUtils.encrypt(content, HttpHelper.KEY);
|
||||
System.err.println("消耗品费用加密数据======:" + encrypt);
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("body", encrypt);
|
||||
|
||||
String body = JSONObject.toJSONString(map);
|
||||
String url = "http://10.138.55.105:8097/micro-server/consumetool/syncConsumeTool";
|
||||
//String url = "http://192.168.1.134:8036/micro-server/consumetool/syncConsumeTool";
|
||||
String data = HttpHelper.sendHttpPost(url, body);
|
||||
JSONObject object = JSONObject.parseObject(data);
|
||||
System.err.println(data);
|
||||
|
||||
String code = object.getString("code");
|
||||
if ("200".equals(code)) {
|
||||
String dataResultString = object.getString("data");
|
||||
// 数据解密
|
||||
String dataArrayString = AesEncryptUtils.decrypt(dataResultString, HttpHelper.KEY);
|
||||
System.err.println("消耗品费用推送返回:"+dataArrayString);
|
||||
JSONArray dataArray = JSONArray.parseArray(dataArrayString);
|
||||
if (dataArray != null && !dataArray.isEmpty()) {
|
||||
// 有数据
|
||||
for (int i = 0; i < dataArray.size(); i++) {
|
||||
JSONObject dataObject = dataArray.getJSONObject(i);
|
||||
String resultId = dataObject.getString("id");
|
||||
String resultPushRemark = dataObject.getString("pushRemark");
|
||||
for (int k = 0; k < list.size(); k++) {
|
||||
ConsumeDataPush consumeDataPush = list.get(k);
|
||||
String id = consumeDataPush.getId();
|
||||
if (resultId.equals(id)) {
|
||||
consumeDataPush.setPushRemark(resultPushRemark);
|
||||
consumeDataPush.setPushStatus("2");
|
||||
list.set(k, consumeDataPush);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
} else {
|
||||
return list;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,221 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.material.push.mapper.CostPushMapper">
|
||||
|
||||
<!-- 获取费用推送审核数据 -->
|
||||
<select id="getCostPushCheckList" parameterType="com.bonus.material.push.domain.CostPushBean" resultType="com.bonus.material.push.domain.CostPushBean">
|
||||
select
|
||||
pmc.id ,
|
||||
pmc.task_id as taskId,
|
||||
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,
|
||||
pmc.CHECK_STATUS as checkStatus
|
||||
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.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
|
||||
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)
|
||||
GROUP BY bai.project_id,bai.unit_id
|
||||
order by pmia.push_status
|
||||
</select>
|
||||
|
||||
<!-- 获取消耗费用推送审核数据 -->
|
||||
<select id="getConsumePushCheckList" parameterType="com.bonus.material.push.domain.CostPushBean" resultType="com.bonus.material.push.domain.CostPushBean">
|
||||
SELECT
|
||||
pmc.id,
|
||||
pmc.task_id AS taskId,
|
||||
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,
|
||||
pmc.CHECK_STATUS AS checkStatus
|
||||
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
|
||||
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 )
|
||||
GROUP BY
|
||||
bai.project_id, bai.unit_id
|
||||
ORDER BY
|
||||
pmia.push_status
|
||||
</select>
|
||||
|
||||
<update id="updateCostPushCheckStatus" parameterType="java.lang.String">
|
||||
update
|
||||
project_month_costs
|
||||
set
|
||||
check_status=1
|
||||
where
|
||||
ID=#{id}
|
||||
</update>
|
||||
|
||||
<select id="getConsumeDataPushsList" parameterType="com.bonus.material.push.domain.CostPushBean"
|
||||
resultType="com.bonus.material.push.domain.ConsumeDataPush">
|
||||
select
|
||||
pmi.id,mmq.`NAME` as name,mm.`NAME` as type,bp.pro_id as
|
||||
projectId,bp.`NAME` as projectName,pmi.unit_name as unitName,
|
||||
pmi.num as quantity,mm.NOTAX_PRICE as netPrice,pmi.money as
|
||||
cost,pmi.time as expenseTime,#{submitUser} as submitUser,cpm.`MONTH`,
|
||||
"1" as pushStatus, bp.`CODE` as pc_no
|
||||
from
|
||||
project_month_info pmi
|
||||
LEFT JOIN calc_project_month cpm on pmi.task_id=cpm.id
|
||||
LEFT JOIN bm_project bp on pmi.PRO_ID=bp.id
|
||||
LEFT JOIN ma_machine_type mm on pmi.type_id=mm.id
|
||||
LEFT JOIN ma_machine_type mmq on mm.PARENT_ID=mmq.id
|
||||
where
|
||||
pmi.task_id =#{taskId} and
|
||||
pmi.PRO_ID=#{projectId} and
|
||||
pmi.type=2 and pmi.unit_id=#{unitId}
|
||||
</select>
|
||||
|
||||
<select id="getToolDataPushList" parameterType="com.bonus.material.push.domain.CostPushBean"
|
||||
resultType="com.bonus.material.push.domain.CostPushBean">
|
||||
select pmi.id,mmq.`NAME` as typeName,mm.`NAME` as
|
||||
modelName,
|
||||
pmi.start_time as
|
||||
leaseDate,pmi.end_time as backDate,
|
||||
pmi.lease_price as
|
||||
leasePrice,pmi.num,pmi.money as
|
||||
money,pmi.time,pmi.type,bp.pro_id as
|
||||
projectId,
|
||||
bp.`NAME` as
|
||||
projectName,pmi.unit_name as
|
||||
unitName,cpm.`MONTH` ,
|
||||
#{submitUser} as
|
||||
submitUser,
|
||||
bp.`CODE` as pc_no
|
||||
from
|
||||
project_month_info pmi
|
||||
LEFT JOIN calc_project_month cpm
|
||||
on pmi.task_id=cpm.id
|
||||
LEFT JOIN bm_project
|
||||
bp on pmi.PRO_ID=bp.id
|
||||
LEFT
|
||||
JOIN ma_machine_type mm on
|
||||
pmi.type_id=mm.id
|
||||
LEFT JOIN ma_machine_type
|
||||
mmq on mm.PARENT_ID=mmq.id
|
||||
where pmi.task_id =#{taskId} and
|
||||
pmi.PRO_ID=#{projectId} and
|
||||
pmi.type=#{type} and pmi.unit_id=#{unitId}
|
||||
</select>
|
||||
|
||||
<update id="updateCostPushStatus" parameterType="com.bonus.material.push.domain.CostPushBean">
|
||||
update
|
||||
project_month_info
|
||||
set
|
||||
push_status=#{pushStatus},push_time=#{time},push_remark=#{pushRemark}
|
||||
where
|
||||
id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updatePushAQStatus" parameterType="com.bonus.material.push.domain.CostPushBean">
|
||||
update
|
||||
project_month_info
|
||||
set
|
||||
push_status = 3
|
||||
where
|
||||
task_id=#{taskId} and pro_id=#{projectId} and unit_id=#{unitId} and type !=2
|
||||
</update>
|
||||
|
||||
<update id="updatePushXHStatus" parameterType="com.bonus.material.push.domain.CostPushBean">
|
||||
update project_month_info set
|
||||
push_status=3
|
||||
where task_id=#{taskId} and pro_id=#{projectId} and unit_id=#{unitId} and type =2
|
||||
</update>
|
||||
|
||||
<select id="findDetails" resultType="com.bonus.material.push.domain.CostPushBean">
|
||||
SELECT
|
||||
mmq.type_name AS typeName,
|
||||
mm.type_name AS modelName,
|
||||
pmi.leaseDate AS leaseDate,
|
||||
pmi.returnDate AS backDate,
|
||||
DATEDIFF( pmi.returnDate, pmi.leaseDate )+ 1 AS dayNum,
|
||||
pmi.leasePrice AS leasePrice,
|
||||
pmi.leaseNum,
|
||||
pmi.leaseMoney AS leaseMoney,
|
||||
pmi.push_time
|
||||
FROM
|
||||
project_month_info pmi
|
||||
LEFT JOIN bm_agreement_info bai ON pmi.agreementId = bai.agreement_id
|
||||
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
||||
LEFT JOIN ma_type mm ON pmi.typeId = mm.type_id
|
||||
LEFT JOIN ma_type mmq ON mm.PARENT_ID = mmq.type_id
|
||||
where
|
||||
pmi.taskId = #{taskId}
|
||||
and bai.project_id = #{projectId}
|
||||
and pmi.typeId = #{type}
|
||||
and bai.unit_id = #{unitId}
|
||||
<if test="typeName != null and typeName != '' ">
|
||||
and mm.`type_name` LIKE CONCAT('%',#{typeName},'%')
|
||||
</if>
|
||||
<if test="modelName != null and modelName != '' ">
|
||||
and mmq.`type_name` LIKE CONCAT('%',#{modelName},'%')
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue