exam-system/src/main/java/com/gkhy/exam/pay/controller/CoalCategoryController.java
@@ -27,9 +27,9 @@ /** * 查询煤矿工种类别列表 */ @PostMapping("/list") @GetMapping("/list") @ApiOperation(value = "查询煤矿工种类别列表") public TableDataInfo list(@RequestBody CoalCategory coalCategory) { public TableDataInfo list(CoalCategory coalCategory) { startPage(); List<CoalCategory> list = coalCategoryService.selectCoalCategoryList(coalCategory); return getDataTable(list); exam-system/src/main/java/com/gkhy/exam/pay/controller/CoalPayController.java
@@ -38,9 +38,9 @@ /** * 查询煤矿缴费管理列表 */ @PostMapping("/list") @GetMapping("/list") @ApiOperation(value = "查询煤矿缴费管理列表") public TableDataInfo list(@RequestBody CoalPayReq coalPayReq) { public TableDataInfo list(CoalPayReq coalPayReq) { startPage(); List<CoalPayRepDto> list = coalPayService.selectCoalPayList(coalPayReq); return getDataTable(list); exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/CoalPayRepDto.java
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.fasterxml.jackson.annotation.JsonFormat; import com.gkhy.exam.pay.entity.CoalCategory; import com.ruoyi.common.core.domain.BaseEntity; import io.swagger.annotations.ApiModel; import lombok.Data; @@ -13,8 +14,7 @@ import java.util.List; @ApiModel(value = "煤矿缴费管理对象详情", description = "煤矿缴费管理对象详情") @Data public class CoalPayRepDto implements Serializable { public class CoalPayRepDto extends BaseEntity implements Serializable { private Long id; /** @@ -63,8 +63,8 @@ */ private String payCompanyCard; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createTime; // @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") // private Date createTime; /** * 总学员数量 @@ -78,5 +78,125 @@ private List<CoalCategory> coalCategoryList; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getBatchName() { return batchName; } public void setBatchName(String batchName) { this.batchName = batchName; } public Long getDeptId() { return deptId; } public void setDeptId(Long deptId) { this.deptId = deptId; } public String getDeptName() { return deptName; } public void setDeptName(String deptName) { this.deptName = deptName; } public Long getPayType() { return payType; } public void setPayType(Long payType) { this.payType = payType; } public BigDecimal getAmount() { return amount; } public void setAmount(BigDecimal amount) { this.amount = amount; } public String getYear() { return year; } public void setYear(String year) { this.year = year; } public Long getQuarter() { return quarter; } public void setQuarter(Long quarter) { this.quarter = quarter; } public Integer getPayPersonType() { return payPersonType; } public void setPayPersonType(Integer payPersonType) { this.payPersonType = payPersonType; } public String getPayCompanyName() { return payCompanyName; } public void setPayCompanyName(String payCompanyName) { this.payCompanyName = payCompanyName; } public String getPayCompanyCard() { return payCompanyCard; } public void setPayCompanyCard(String payCompanyCard) { this.payCompanyCard = payCompanyCard; } // // @Override // public Date getCreateTime() { // return createTime; // } // // @Override // public void setCreateTime(Date createTime) { // this.createTime = createTime; // } public Integer getTotalNum() { return totalNum; } public void setTotalNum(Integer totalNum) { this.totalNum = totalNum; } public Integer getHavePayNum() { return havePayNum; } public void setHavePayNum(Integer havePayNum) { this.havePayNum = havePayNum; } public List<CoalCategory> getCoalCategoryList() { return coalCategoryList; } public void setCoalCategoryList(List<CoalCategory> coalCategoryList) { this.coalCategoryList = coalCategoryList; } } exam-system/src/main/java/com/gkhy/exam/pay/dto/req/CoalPayReq.java
@@ -1,15 +1,41 @@ package com.gkhy.exam.pay.dto.req; import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.core.domain.BaseEntity; import lombok.Data; import lombok.Getter; import lombok.Setter; import java.util.Date; @Data public class CoalPayReq { public class CoalPayReq extends BaseEntity { @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date minDate; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date maxDate; private Long deptId; public Date getMinDate() { return minDate; } public void setMinDate(Date minDate) { this.minDate = minDate; } public Date getMaxDate() { return maxDate; } public void setMaxDate(Date maxDate) { this.maxDate = maxDate; } public Long getDeptId() { return deptId; } public void setDeptId(Long deptId) { this.deptId = deptId; } } exam-system/src/main/java/com/gkhy/exam/pay/mapper/CoalPayMapper.java
@@ -1,6 +1,7 @@ package com.gkhy.exam.pay.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.gkhy.exam.pay.dto.rep.CoalPayRepDto; import com.gkhy.exam.pay.dto.req.CoalPayDto; import com.gkhy.exam.pay.dto.req.CoalPayReq; import com.gkhy.exam.pay.dto.req.CoalPayTypeReq; @@ -9,7 +10,7 @@ import java.util.List; public interface CoalPayMapper extends BaseMapper<CoalPay> { List<CoalPay> selectCoalPayList(CoalPayReq coalPay); List<CoalPayRepDto> selectCoalPayList(CoalPayReq coalPay); int insertBath(CoalPay coalPay); exam-system/src/main/java/com/gkhy/exam/pay/service/impl/CoalPayServiceImpl.java
@@ -69,27 +69,27 @@ */ @Override public List<CoalPayRepDto> selectCoalPayList(CoalPayReq coalPay) { List<CoalPayRepDto> coalPayRepDtos = new ArrayList<>(); List<CoalPay> coalPays = coalPayMapper.selectCoalPayList(coalPay); for (CoalPay pay : coalPays) { CoalPayRepDto coalPayRepDto = new CoalPayRepDto(); BeanUtils.copyProperties(pay, coalPayRepDto); // List<CoalPayRepDto> coalPayRepDtos = new ArrayList<>(); List<CoalPayRepDto> coalPays = coalPayMapper.selectCoalPayList(coalPay); for (CoalPayRepDto pay : coalPays) { // CoalPayRepDto coalPayRepDto = new CoalPayRepDto(); // BeanUtils.copyProperties(pay, coalPayRepDto); //部门数据 SysDept sysDept = sysDeptMapper.selectDeptById(pay.getDeptId()); coalPayRepDto.setDeptName(sysDept.getDeptName()); pay.setDeptName(sysDept.getDeptName()); //工种数据 List<CoalCategory> coalCategories = coalCategoryMapper.selectByCoalPayId(pay.getId()); coalPayRepDto.setCoalCategoryList(coalCategories); pay.setCoalCategoryList(coalCategories); //学员数据 List<CoalPayStudent> coalPayStudents = coalPayStudentService.selectByCoalPayId(pay.getId()); List<CoalPayStudent> havePay = coalPayStudents.stream() .filter(stu -> stu.getPayStatus() != null && stu.getPayStatus() == 1) .collect(Collectors.toList()); coalPayRepDto.setTotalNum(coalPayStudents.size()); coalPayRepDto.setHavePayNum(havePay.size()); coalPayRepDtos.add(coalPayRepDto); pay.setTotalNum(coalPayStudents.size()); pay.setHavePayNum(havePay.size()); // coalPayRepDtos.add(coalPayRepDto); } return coalPayRepDtos; return coalPays; } @Override exam-system/src/main/java/com/gkhy/exam/pay/utils/PayUtils.java
@@ -408,11 +408,11 @@ String reqdatastr = JSONObject.toJSONString(payReqData); String mac = this.getMD5(appId + this.getBase64(reqdatastr)); String mac = this.getMD5(appId+"||"+ this.getBase64(payReqData)); JSONObject jsonObject = new JSONObject(); jsonObject.put("appid", appId); jsonObject.put("mac", mac); jsonObject.put("reqdata", this.getBase64(reqdatastr)); jsonObject.put("reqdata", this.getBase64(payReqData)); Map<String, String> header = new HashMap(); header.put("Accept", "application/json;charset=utf-8"); header.put("Content-Type", "application/json;charset=utf-8"); @@ -425,7 +425,9 @@ JSONObject jsonObject2 = result.getJSONObject("respdata"); String signfile = jsonObject2.getString("fileData"); String orderNo1 = jsonObject2.getString("orderNo"); String xmlFilePath = "F:/files/" + orderNo1 + ".xml"; // /home/www/swspkmas/files/ // String xmlFilePath = "/home/www/swspkmas/files/" + orderNo1 + ".xml"; String xmlFilePath = "F:\\text\\" + orderNo1 + ".xml"; generateBase64StringToFile(signfile, xmlFilePath); String trr2 = ""; @@ -559,7 +561,7 @@ Map<String, Object> mmp = new HashMap(); try { String filePath = "/www/wwwroot/exam/cssconfig.properties"; String filePath = "F:\\text/cssconfig.properties"; System.out.println("配置文件路径:" + filePath); MOFClient client = new MOFClient(filePath); System.out.println("证书标识为:" + certId); @@ -630,9 +632,12 @@ } } public String getBase64(String str) { String encodedStr = org.apache.commons.codec.binary.Base64.encodeBase64String(str.getBytes()); return encodedStr; public String getBase64(PayReqData str) { // String encodedStr = org.apache.commons.codec.binary.Base64.encodeBase64String(str.getBytes()); String reqData = Base64.getEncoder().encodeToString(JSONObject.toJSONString(str).getBytes()); return reqData; } @@ -670,7 +675,8 @@ // Map<String, Object> mmp = new HashMap<>(); try { String filePath = "F:\\text\\cssconfig.properties"; // String filePath = "/home/www/swspkmas/cssconfig.properties"; String filePath = "F:\\text/cssconfig.properties"; System.out.println("配置文件路径:" + filePath); MOFClient client = new MOFClient(filePath); System.out.println("证书标识为:" + certId); @@ -705,7 +711,7 @@ SignResult result = null; String certId = "11650000MB1957293J"; try { MOFClient client = new MOFClient("F:\\text\\cssconfig.properties"); MOFClient client = new MOFClient("/home/www/swspkmas/cssconfig.properties"); result = client.sign(certId, strData.getBytes(StandardCharsets.UTF_8)); log.info("***签名成功***"); log.info("签名返回结果为:" + result); @@ -727,7 +733,7 @@ public MOFVerifyResult verify(byte[] strData, String signData) { MOFVerifyResult verify = null; try { MOFClient client = new MOFClient("F:\\text\\cssconfig.properties"); MOFClient client = new MOFClient("/home/www/swspkmas/cssconfig.properties"); verify = client.verifySign(strData, signData.getBytes(StandardCharsets.UTF_8)); log.info("验签成功"); @@ -751,7 +757,7 @@ public EnvelopResult encryptEnvelop(byte[] plain) { EnvelopResult envelopResult = null; try { AdvanceSignClient client = new AdvanceSignClient("F:\\text\\cssconfig.properties"); AdvanceSignClient client = new AdvanceSignClient("/home/www/swspkmas/cssconfig.properties"); String certId = "rsa"; CertIdParams certIdParams = new CertIdParams(certId); //将封装好的加密证书参数对象放入 数组中 @@ -772,7 +778,7 @@ public DecryptResult decryptEnvelop(String signData) { DecryptResult result = null; try { AdvanceSignClient client = new AdvanceSignClient("F:\\text\\cssconfig.properties"); AdvanceSignClient client = new AdvanceSignClient("/home/www/swspkmas/cssconfig.properties"); byte[] enc_data = signData.getBytes(); result = client.decryptEnvelop(enc_data); log.info("解密数字信封结果成功"); exam-system/src/main/java/com/gkhy/exam/pay/utils/SignDto.java
@@ -2,6 +2,7 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.TimeZone; public class SignDto { @@ -13,13 +14,23 @@ private String serialNumber; private static final String UTC_DATE_TIME = "dd MMM yyyy HH:mm:ss z"; // public static String formatWithTimeZone(Date date) { // /* 48 */ // SimpleDateFormat sdf = new SimpleDateFormat(); // /* 49 */ // sdf.setTimeZone(TimeZone.getTimeZone("GMT+8")); // /* 50 */ // sdf.applyPattern("dd MMM yyyy HH:mm:ss z"); // /* 51 */ // return sdf.format(date); // } public static String formatWithTimeZone(Date date) { /* 48 */ SimpleDateFormat sdf = new SimpleDateFormat(); SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy HH:mm:ss z", Locale.CHINA); /* 49 */ sdf.setTimeZone(TimeZone.getTimeZone("GMT+8")); /* 50 */ sdf.applyPattern("dd MMM yyyy HH:mm:ss z"); // sdf.applyPattern("dd MMM yyyy HH:mm:ss z", Locale.CHINA); /* 51 */ return sdf.format(date); } exam-system/src/main/resources/mapper/pay/CoalPayMapper.xml
@@ -105,9 +105,7 @@ </trim> where id = #{id} </update> <select id="selectCoalPayList" parameterType="CoalPay" resultMap="CoalPayResult"> <select id="selectCoalPayList" resultType="com.gkhy.exam.pay.dto.rep.CoalPayRepDto"> <include refid="selectCoalPayVo"/> <where> <if test="deptId != null "> @@ -123,4 +121,22 @@ order by create_time desc </where> </select> <!-- <select id="selectCoalPayList" parameterType="CoalPay">--> <!-- <include refid="selectCoalPayVo"/>--> <!-- <where>--> <!-- <if test="deptId != null ">--> <!-- and dept_id = #{deptId}--> <!-- </if>--> <!-- <if test="minDate !=null">--> <!-- and create_time >= #{minDate}--> <!-- </if>--> <!-- <if test="maxDate != null">--> <!-- and create_time <= #{maxDate}--> <!-- </if>--> <!-- and del_flag = 0--> <!-- order by create_time desc--> <!-- </where>--> <!--<!– </select>–>--> </mapper>