From 603995884372c46c6fe17bf5e178cfbef3c8d933 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Fri, 31 Aug 2018 11:19:07 +0800 Subject: [PATCH 01/24] 1 --- .../java/com/hai/dao/HighApproveMapper.java | 66 +++++++++++++-- .../com/hai/dao/HighApproveSqlProvider.java | 80 ++++++++++++++++++- .../main/java/com/hai/entity/HighApprove.java | 18 ++++- .../com/hai/entity/HighApproveExample.java | 47 ++++++++--- 4 files changed, 188 insertions(+), 23 deletions(-) diff --git a/hai-service/src/main/java/com/hai/dao/HighApproveMapper.java b/hai-service/src/main/java/com/hai/dao/HighApproveMapper.java index 1af2b2d2..660382e9 100644 --- a/hai-service/src/main/java/com/hai/dao/HighApproveMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighApproveMapper.java @@ -45,14 +45,16 @@ public interface HighApproveMapper extends HighApproveMapperExt { "create_time, update_time, ", "submit_operator_id, submit_operator_name, ", "approve_operator_id, approve_operator_name, ", - "ext_1, ext_2, ext_3)", + "ext_1, ext_2, ext_3, ", + "approve_object)", "values (#{objectType,jdbcType=INTEGER}, #{objectId,jdbcType=BIGINT}, ", "#{objectName,jdbcType=VARCHAR}, #{approveSerialNo,jdbcType=VARCHAR}, ", "#{remarks,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ", - "#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", + "#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=DATE}, ", "#{submitOperatorId,jdbcType=BIGINT}, #{submitOperatorName,jdbcType=VARCHAR}, ", "#{approveOperatorId,jdbcType=BIGINT}, #{approveOperatorName,jdbcType=VARCHAR}, ", - "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, ", + "#{approveObject,jdbcType=LONGVARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(HighApprove record); @@ -61,6 +63,28 @@ public interface HighApproveMapper extends HighApproveMapperExt { @Options(useGeneratedKeys=true,keyProperty="id") int insertSelective(HighApprove record); + @SelectProvider(type=HighApproveSqlProvider.class, method="selectByExampleWithBLOBs") + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="object_type", property="objectType", jdbcType=JdbcType.INTEGER), + @Result(column="object_id", property="objectId", jdbcType=JdbcType.BIGINT), + @Result(column="object_name", property="objectName", jdbcType=JdbcType.VARCHAR), + @Result(column="approve_serial_no", property="approveSerialNo", jdbcType=JdbcType.VARCHAR), + @Result(column="remarks", property="remarks", jdbcType=JdbcType.VARCHAR), + @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), + @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="update_time", property="updateTime", jdbcType=JdbcType.DATE), + @Result(column="submit_operator_id", property="submitOperatorId", jdbcType=JdbcType.BIGINT), + @Result(column="submit_operator_name", property="submitOperatorName", jdbcType=JdbcType.VARCHAR), + @Result(column="approve_operator_id", property="approveOperatorId", jdbcType=JdbcType.BIGINT), + @Result(column="approve_operator_name", property="approveOperatorName", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR), + @Result(column="approve_object", property="approveObject", jdbcType=JdbcType.LONGVARCHAR) + }) + List selectByExampleWithBLOBs(HighApproveExample example); + @SelectProvider(type=HighApproveSqlProvider.class, method="selectByExample") @Results({ @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @@ -71,7 +95,7 @@ public interface HighApproveMapper extends HighApproveMapperExt { @Result(column="remarks", property="remarks", jdbcType=JdbcType.VARCHAR), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), - @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="update_time", property="updateTime", jdbcType=JdbcType.DATE), @Result(column="submit_operator_id", property="submitOperatorId", jdbcType=JdbcType.BIGINT), @Result(column="submit_operator_name", property="submitOperatorName", jdbcType=JdbcType.VARCHAR), @Result(column="approve_operator_id", property="approveOperatorId", jdbcType=JdbcType.BIGINT), @@ -86,7 +110,7 @@ public interface HighApproveMapper extends HighApproveMapperExt { "select", "id, object_type, object_id, object_name, approve_serial_no, remarks, `status`, ", "create_time, update_time, submit_operator_id, submit_operator_name, approve_operator_id, ", - "approve_operator_name, ext_1, ext_2, ext_3", + "approve_operator_name, ext_1, ext_2, ext_3, approve_object", "from high_approve", "where id = #{id,jdbcType=BIGINT}" }) @@ -99,20 +123,24 @@ public interface HighApproveMapper extends HighApproveMapperExt { @Result(column="remarks", property="remarks", jdbcType=JdbcType.VARCHAR), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), - @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="update_time", property="updateTime", jdbcType=JdbcType.DATE), @Result(column="submit_operator_id", property="submitOperatorId", jdbcType=JdbcType.BIGINT), @Result(column="submit_operator_name", property="submitOperatorName", jdbcType=JdbcType.VARCHAR), @Result(column="approve_operator_id", property="approveOperatorId", jdbcType=JdbcType.BIGINT), @Result(column="approve_operator_name", property="approveOperatorName", jdbcType=JdbcType.VARCHAR), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), - @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) + @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR), + @Result(column="approve_object", property="approveObject", jdbcType=JdbcType.LONGVARCHAR) }) HighApprove selectByPrimaryKey(Long id); @UpdateProvider(type=HighApproveSqlProvider.class, method="updateByExampleSelective") int updateByExampleSelective(@Param("record") HighApprove record, @Param("example") HighApproveExample example); + @UpdateProvider(type=HighApproveSqlProvider.class, method="updateByExampleWithBLOBs") + int updateByExampleWithBLOBs(@Param("record") HighApprove record, @Param("example") HighApproveExample example); + @UpdateProvider(type=HighApproveSqlProvider.class, method="updateByExample") int updateByExample(@Param("record") HighApprove record, @Param("example") HighApproveExample example); @@ -128,7 +156,29 @@ public interface HighApproveMapper extends HighApproveMapperExt { "remarks = #{remarks,jdbcType=VARCHAR},", "`status` = #{status,jdbcType=INTEGER},", "create_time = #{createTime,jdbcType=TIMESTAMP},", - "update_time = #{updateTime,jdbcType=TIMESTAMP},", + "update_time = #{updateTime,jdbcType=DATE},", + "submit_operator_id = #{submitOperatorId,jdbcType=BIGINT},", + "submit_operator_name = #{submitOperatorName,jdbcType=VARCHAR},", + "approve_operator_id = #{approveOperatorId,jdbcType=BIGINT},", + "approve_operator_name = #{approveOperatorName,jdbcType=VARCHAR},", + "ext_1 = #{ext1,jdbcType=VARCHAR},", + "ext_2 = #{ext2,jdbcType=VARCHAR},", + "ext_3 = #{ext3,jdbcType=VARCHAR},", + "approve_object = #{approveObject,jdbcType=LONGVARCHAR}", + "where id = #{id,jdbcType=BIGINT}" + }) + int updateByPrimaryKeyWithBLOBs(HighApprove record); + + @Update({ + "update high_approve", + "set object_type = #{objectType,jdbcType=INTEGER},", + "object_id = #{objectId,jdbcType=BIGINT},", + "object_name = #{objectName,jdbcType=VARCHAR},", + "approve_serial_no = #{approveSerialNo,jdbcType=VARCHAR},", + "remarks = #{remarks,jdbcType=VARCHAR},", + "`status` = #{status,jdbcType=INTEGER},", + "create_time = #{createTime,jdbcType=TIMESTAMP},", + "update_time = #{updateTime,jdbcType=DATE},", "submit_operator_id = #{submitOperatorId,jdbcType=BIGINT},", "submit_operator_name = #{submitOperatorName,jdbcType=VARCHAR},", "approve_operator_id = #{approveOperatorId,jdbcType=BIGINT},", diff --git a/hai-service/src/main/java/com/hai/dao/HighApproveSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighApproveSqlProvider.java index 1ad8c3ea..9ff5161d 100644 --- a/hai-service/src/main/java/com/hai/dao/HighApproveSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighApproveSqlProvider.java @@ -57,7 +57,7 @@ public class HighApproveSqlProvider { } if (record.getUpdateTime() != null) { - sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}"); + sql.VALUES("update_time", "#{updateTime,jdbcType=DATE}"); } if (record.getSubmitOperatorId() != null) { @@ -88,6 +88,43 @@ public class HighApproveSqlProvider { sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}"); } + if (record.getApproveObject() != null) { + sql.VALUES("approve_object", "#{approveObject,jdbcType=LONGVARCHAR}"); + } + + return sql.toString(); + } + + public String selectByExampleWithBLOBs(HighApproveExample example) { + SQL sql = new SQL(); + if (example != null && example.isDistinct()) { + sql.SELECT_DISTINCT("id"); + } else { + sql.SELECT("id"); + } + sql.SELECT("object_type"); + sql.SELECT("object_id"); + sql.SELECT("object_name"); + sql.SELECT("approve_serial_no"); + sql.SELECT("remarks"); + sql.SELECT("`status`"); + sql.SELECT("create_time"); + sql.SELECT("update_time"); + sql.SELECT("submit_operator_id"); + sql.SELECT("submit_operator_name"); + sql.SELECT("approve_operator_id"); + sql.SELECT("approve_operator_name"); + sql.SELECT("ext_1"); + sql.SELECT("ext_2"); + sql.SELECT("ext_3"); + sql.SELECT("approve_object"); + sql.FROM("high_approve"); + applyWhere(sql, example, false); + + if (example != null && example.getOrderByClause() != null) { + sql.ORDER_BY(example.getOrderByClause()); + } + return sql.toString(); } @@ -163,7 +200,7 @@ public class HighApproveSqlProvider { } if (record.getUpdateTime() != null) { - sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); + sql.SET("update_time = #{record.updateTime,jdbcType=DATE}"); } if (record.getSubmitOperatorId() != null) { @@ -194,6 +231,37 @@ public class HighApproveSqlProvider { sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); } + if (record.getApproveObject() != null) { + sql.SET("approve_object = #{record.approveObject,jdbcType=LONGVARCHAR}"); + } + + applyWhere(sql, example, true); + return sql.toString(); + } + + public String updateByExampleWithBLOBs(Map parameter) { + SQL sql = new SQL(); + sql.UPDATE("high_approve"); + + sql.SET("id = #{record.id,jdbcType=BIGINT}"); + sql.SET("object_type = #{record.objectType,jdbcType=INTEGER}"); + sql.SET("object_id = #{record.objectId,jdbcType=BIGINT}"); + sql.SET("object_name = #{record.objectName,jdbcType=VARCHAR}"); + sql.SET("approve_serial_no = #{record.approveSerialNo,jdbcType=VARCHAR}"); + sql.SET("remarks = #{record.remarks,jdbcType=VARCHAR}"); + sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); + sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); + sql.SET("update_time = #{record.updateTime,jdbcType=DATE}"); + sql.SET("submit_operator_id = #{record.submitOperatorId,jdbcType=BIGINT}"); + sql.SET("submit_operator_name = #{record.submitOperatorName,jdbcType=VARCHAR}"); + sql.SET("approve_operator_id = #{record.approveOperatorId,jdbcType=BIGINT}"); + sql.SET("approve_operator_name = #{record.approveOperatorName,jdbcType=VARCHAR}"); + sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); + sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); + sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); + sql.SET("approve_object = #{record.approveObject,jdbcType=LONGVARCHAR}"); + + HighApproveExample example = (HighApproveExample) parameter.get("example"); applyWhere(sql, example, true); return sql.toString(); } @@ -210,7 +278,7 @@ public class HighApproveSqlProvider { sql.SET("remarks = #{record.remarks,jdbcType=VARCHAR}"); sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); - sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); + sql.SET("update_time = #{record.updateTime,jdbcType=DATE}"); sql.SET("submit_operator_id = #{record.submitOperatorId,jdbcType=BIGINT}"); sql.SET("submit_operator_name = #{record.submitOperatorName,jdbcType=VARCHAR}"); sql.SET("approve_operator_id = #{record.approveOperatorId,jdbcType=BIGINT}"); @@ -257,7 +325,7 @@ public class HighApproveSqlProvider { } if (record.getUpdateTime() != null) { - sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}"); + sql.SET("update_time = #{updateTime,jdbcType=DATE}"); } if (record.getSubmitOperatorId() != null) { @@ -288,6 +356,10 @@ public class HighApproveSqlProvider { sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}"); } + if (record.getApproveObject() != null) { + sql.SET("approve_object = #{approveObject,jdbcType=LONGVARCHAR}"); + } + sql.WHERE("id = #{id,jdbcType=BIGINT}"); return sql.toString(); diff --git a/hai-service/src/main/java/com/hai/entity/HighApprove.java b/hai-service/src/main/java/com/hai/entity/HighApprove.java index daa7334e..faef4315 100644 --- a/hai-service/src/main/java/com/hai/entity/HighApprove.java +++ b/hai-service/src/main/java/com/hai/entity/HighApprove.java @@ -84,6 +84,11 @@ public class HighApprove implements Serializable { private String ext3; + /** + * 审批对象 + */ + private String approveObject; + private static final long serialVersionUID = 1L; public Long getId() { @@ -214,6 +219,14 @@ public class HighApprove implements Serializable { this.ext3 = ext3; } + public String getApproveObject() { + return approveObject; + } + + public void setApproveObject(String approveObject) { + this.approveObject = approveObject; + } + @Override public boolean equals(Object that) { if (this == that) { @@ -241,7 +254,8 @@ public class HighApprove implements Serializable { && (this.getApproveOperatorName() == null ? other.getApproveOperatorName() == null : this.getApproveOperatorName().equals(other.getApproveOperatorName())) && (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) && (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) - && (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())); + && (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())) + && (this.getApproveObject() == null ? other.getApproveObject() == null : this.getApproveObject().equals(other.getApproveObject())); } @Override @@ -264,6 +278,7 @@ public class HighApprove implements Serializable { result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode()); + result = prime * result + ((getApproveObject() == null) ? 0 : getApproveObject().hashCode()); return result; } @@ -289,6 +304,7 @@ public class HighApprove implements Serializable { sb.append(", ext1=").append(ext1); sb.append(", ext2=").append(ext2); sb.append(", ext3=").append(ext3); + sb.append(", approveObject=").append(approveObject); sb.append(", serialVersionUID=").append(serialVersionUID); sb.append("]"); return sb.toString(); diff --git a/hai-service/src/main/java/com/hai/entity/HighApproveExample.java b/hai-service/src/main/java/com/hai/entity/HighApproveExample.java index 8bdb2317..f0fa0e3b 100644 --- a/hai-service/src/main/java/com/hai/entity/HighApproveExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighApproveExample.java @@ -2,6 +2,7 @@ package com.hai.entity; import java.util.ArrayList; import java.util.Date; +import java.util.Iterator; import java.util.List; public class HighApproveExample { @@ -125,6 +126,32 @@ public class HighApproveExample { criteria.add(new Criterion(condition, value1, value2)); } + protected void addCriterionForJDBCDate(String condition, Date value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + addCriterion(condition, new java.sql.Date(value.getTime()), property); + } + + protected void addCriterionForJDBCDate(String condition, List values, String property) { + if (values == null || values.size() == 0) { + throw new RuntimeException("Value list for " + property + " cannot be null or empty"); + } + List dateList = new ArrayList(); + Iterator iter = values.iterator(); + while (iter.hasNext()) { + dateList.add(new java.sql.Date(iter.next().getTime())); + } + addCriterion(condition, dateList, property); + } + + protected void addCriterionForJDBCDate(String condition, Date value1, Date value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + addCriterion(condition, new java.sql.Date(value1.getTime()), new java.sql.Date(value2.getTime()), property); + } + public Criteria andIdIsNull() { addCriterion("id is null"); return (Criteria) this; @@ -646,52 +673,52 @@ public class HighApproveExample { } public Criteria andUpdateTimeEqualTo(Date value) { - addCriterion("update_time =", value, "updateTime"); + addCriterionForJDBCDate("update_time =", value, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeNotEqualTo(Date value) { - addCriterion("update_time <>", value, "updateTime"); + addCriterionForJDBCDate("update_time <>", value, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeGreaterThan(Date value) { - addCriterion("update_time >", value, "updateTime"); + addCriterionForJDBCDate("update_time >", value, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { - addCriterion("update_time >=", value, "updateTime"); + addCriterionForJDBCDate("update_time >=", value, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeLessThan(Date value) { - addCriterion("update_time <", value, "updateTime"); + addCriterionForJDBCDate("update_time <", value, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { - addCriterion("update_time <=", value, "updateTime"); + addCriterionForJDBCDate("update_time <=", value, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeIn(List values) { - addCriterion("update_time in", values, "updateTime"); + addCriterionForJDBCDate("update_time in", values, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeNotIn(List values) { - addCriterion("update_time not in", values, "updateTime"); + addCriterionForJDBCDate("update_time not in", values, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeBetween(Date value1, Date value2) { - addCriterion("update_time between", value1, value2, "updateTime"); + addCriterionForJDBCDate("update_time between", value1, value2, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { - addCriterion("update_time not between", value1, value2, "updateTime"); + addCriterionForJDBCDate("update_time not between", value1, value2, "updateTime"); return (Criteria) this; } From 6a4aeaeaa7f743ebb0a65c003d9466fac0796fcd Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Mon, 22 Aug 2022 17:27:31 +0800 Subject: [PATCH 02/24] 1 --- .../BsDistributionUserRelController.java | 158 +++++++++ .../HighTyAgentOilStationController.java | 6 - .../bweb/controller/HighUserController.java | 30 ++ .../main/java/com/cweb/config/SysConfig.java | 9 + .../cweb/controller/HighTestController.java | 2 +- .../controller/HighUserCommonController.java | 9 +- .../cweb/controller/HighUserController.java | 110 +++++++ .../com/cweb/controller/WechatController.java | 79 +++-- .../src/main/resources/dev/config.properties | 2 + .../resources/prod-9401/config.properties | 3 + .../src/main/resources/prod/config.properties | 3 + .../com/hai/schedule/HighOrderSchedule.java | 9 + .../java/com/hai/common/QRCodeGenerator.java | 10 - .../java/com/hai/common/utils/ImageUtils.java | 307 ++++++++++++++++++ .../java/com/hai/common/utils/TelApiUtil.java | 3 + .../java/com/hai/common/utils/WxUtils.java | 2 +- .../java/com/hai/config/CommonConfig.java | 169 ++++++++++ .../java/com/hai/config/CommonSysConfig.java | 10 + .../dao/BsDistributionRebateMapperExt.java | 24 +- .../hai/dao/BsDistributionUserRelMapper.java | 17 +- .../dao/BsDistributionUserRelMapperExt.java | 37 ++- .../dao/BsDistributionUserRelSqlProvider.java | 14 + .../com/hai/dao/BsRequestRecordMapperExt.java | 9 +- .../java/com/hai/dao/HighOrderMapper.java | 2 +- .../com/hai/entity/BsDistributionUserRel.java | 18 +- .../entity/BsDistributionUserRelExample.java | 70 ++++ .../main/java/com/hai/entity/HighOrder.java | 30 ++ .../java/com/hai/enum_type/GoodsType.java | 6 +- .../java/com/hai/enum_type/OrderLogoEnum.java | 49 +++ .../service/BsDistributionUserRelService.java | 86 ++++- .../com/hai/service/HighOrderService.java | 21 ++ .../java/com/hai/service/HighUserService.java | 14 +- .../BsDistributionUserRelServiceImpl.java | 266 ++++++++++++++- .../impl/BsIntegralRebateServiceImpl.java | 22 +- .../impl/HighDiscountPackageServiceImpl.java | 2 +- .../service/impl/HighOrderServiceImpl.java | 61 +++- .../hai/service/impl/HighUserServiceImpl.java | 18 +- .../resources/dev/commonConfig.properties | 5 + .../prod-9401/commonConfig.properties | 3 + .../resources/prod/commonConfig.properties | 3 + .../v1/controller/GzSinopecController.java | 6 +- .../v1/controller/HighOrderController.java | 11 +- .../controller/RechargeProductController.java | 8 +- .../controller/SelfOilStationController.java | 2 +- 44 files changed, 1637 insertions(+), 88 deletions(-) create mode 100644 hai-bweb/src/main/java/com/bweb/controller/BsDistributionUserRelController.java create mode 100644 hai-service/src/main/java/com/hai/common/utils/ImageUtils.java create mode 100644 hai-service/src/main/java/com/hai/config/CommonConfig.java create mode 100644 hai-service/src/main/java/com/hai/enum_type/OrderLogoEnum.java diff --git a/hai-bweb/src/main/java/com/bweb/controller/BsDistributionUserRelController.java b/hai-bweb/src/main/java/com/bweb/controller/BsDistributionUserRelController.java new file mode 100644 index 00000000..1afd1921 --- /dev/null +++ b/hai-bweb/src/main/java/com/bweb/controller/BsDistributionUserRelController.java @@ -0,0 +1,158 @@ +package com.bweb.controller; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hai.common.security.SessionObject; +import com.hai.common.security.UserCenter; +import com.hai.common.utils.ResponseMsgUtil; +import com.hai.model.HighUserModel; +import com.hai.model.ResponseData; +import com.hai.service.BsDistributionUserRelService; +import com.hai.service.HighOrderService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.text.SimpleDateFormat; +import java.util.HashMap; +import java.util.Map; + +@Controller +@RequestMapping(value = "/bsDistributionUserRel") +@Api(value = "分销人员") +public class BsDistributionUserRelController { + + private static Logger log = LoggerFactory.getLogger(BsIntegralRebateController.class); + + @Autowired + private UserCenter userCenter; + + @Resource + private HighOrderService highOrderService; + + @Resource + private BsDistributionUserRelService bsDistributionUserRelService; + + @RequestMapping(value = "/getDistributionAgent", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询分销代理商") + public ResponseData getDistributionAgent() { + try { + + return ResponseMsgUtil.success(bsDistributionUserRelService.getDistributionAgent()); + + } catch (Exception e) { + log.error("HighOrderController --> getOrderById() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/getDistributionFirst", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询分销一级") + public ResponseData getDistributionFirst(@RequestParam(name = "agentId", required = false) Long agentId) { + try { + + return ResponseMsgUtil.success(bsDistributionUserRelService.getDistributionFirst(agentId)); + + } catch (Exception e) { + log.error("HighOrderController --> getOrderById() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/getDistributionSecond", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询分销二级") + public ResponseData getDistributionSecond(@RequestParam(name = "agentId", required = false) Long agentId, + @RequestParam(name = "popularizeUserId", required = false) Long popularizeUserId) { + try { + + return ResponseMsgUtil.success(bsDistributionUserRelService.getDistributionSecond(agentId , popularizeUserId)); + + } catch (Exception e) { + log.error("HighOrderController --> getOrderById() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/getDistributionIntegralList", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询分销积分记录") + public ResponseData getDistributionIntegralList(@RequestParam(name = "title", required = false) String title, + @RequestParam(name = "type", required = false) Integer type, + @RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "agentId", required = false) Long agentId, + @RequestParam(name = "popularizeUserId", required = false) Long popularizeUserId, + @RequestParam(name = "userName", required = false) String userName, + @RequestParam(name = "createTimeS", required = false) Long createTimeS, + @RequestParam(name = "createTimeE", required = false) Long createTimeE, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize + ) { + try { + + Map map = new HashMap<>(); + + map.put("title", title); + map.put("type", type); + map.put("orderNo", orderNo); + map.put("agentId", agentId); + map.put("popularizeUserId", popularizeUserId); + map.put("userName", userName); + + if (createTimeS != null && createTimeE != null) { + map.put("createTimeS", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTimeS)); + map.put("createTimeE", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTimeE)); + } + + PageHelper.startPage(pageNum, pageSize); + return ResponseMsgUtil.success(new PageInfo<>(bsDistributionUserRelService.getDistributionIntegralList(map))); + } catch (Exception e) { + log.error("HighOrderController --> getOrderById() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/agentUserList", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询代理商用户") + public ResponseData agentUserList() { + try { + + return ResponseMsgUtil.success(bsDistributionUserRelService.agentUserList()); + + } catch (Exception e) { + log.error("HighOrderController --> getOrderById() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/orderListByAgentId", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "B端查询代理商订单") + public ResponseData orderListByAgentId(@RequestParam(name = "agentId", required = false) Long agentId, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize) { + try { + + Map map = new HashMap<>(); + map.put("agentId" , agentId); + + PageHelper.startPage(pageNum,pageSize); + return ResponseMsgUtil.success(new PageInfo<>(highOrderService.orderListByAgentId(map))); + } catch (Exception e) { + log.error("HighOrderController --> getBackendToken() error!", e); + return ResponseMsgUtil.exception(e); + } + } +} diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighTyAgentOilStationController.java b/hai-bweb/src/main/java/com/bweb/controller/HighTyAgentOilStationController.java index b3db9988..90e2cd46 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighTyAgentOilStationController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighTyAgentOilStationController.java @@ -43,12 +43,6 @@ public class HighTyAgentOilStationController { @Resource private HighTyAgentOilStationService highTyAgentOilStationService; - @Resource - private BsOrganizationService organizationService; - - @Resource - private HighTySalesmanService tySalesmanService; - @Resource private UserCenter userCenter; diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighUserController.java b/hai-bweb/src/main/java/com/bweb/controller/HighUserController.java index eaac0312..c0600141 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighUserController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighUserController.java @@ -165,4 +165,34 @@ public class HighUserController { } } + + @RequestMapping(value = "/setUpAgent", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "设置代理商") + public ResponseData setUpAgent(@RequestParam(value = "userId" , required = true) Long userId) { + try { + + HighUser highUser = highUserService.findByUserId(userId); + + if (highUser == null) { + log.error("HighUserController --> forbiddenUser() error!"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_USER_ERROR, ""); + } + + if (highUser.getIsAgent() == null || !highUser.getIsAgent()) { + highUser.setIsAgent(true); + } else { + highUser.setIsAgent(false); + } + + highUserService.updateUser(highUser); + + return ResponseMsgUtil.success("设置成功"); + + } catch (Exception e) { + log.error("BsPositionController --> addPosition() error!", e); + return ResponseMsgUtil.exception(e); + } + } + } diff --git a/hai-cweb/src/main/java/com/cweb/config/SysConfig.java b/hai-cweb/src/main/java/com/cweb/config/SysConfig.java index 3753b3ef..6b3ff21a 100644 --- a/hai-cweb/src/main/java/com/cweb/config/SysConfig.java +++ b/hai-cweb/src/main/java/com/cweb/config/SysConfig.java @@ -30,6 +30,7 @@ public class SysConfig { private String wxGzSubAppId; private String wxGzSubMchId; + private String qrCodeUrl; // 重庆电子商务有限公司 private String HDAppId; @@ -177,4 +178,12 @@ public class SysConfig { public void setImgUrl(String imgUrl) { this.imgUrl = imgUrl; } + + public String getQrCodeUrl() { + return qrCodeUrl; + } + + public void setQrCodeUrl(String qrCodeUrl) { + this.qrCodeUrl = qrCodeUrl; + } } diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java b/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java index 8496a5b8..eb66ee1b 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java @@ -1 +1 @@ -package com.cweb.controller; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.cweb.config.SysConst; import com.hai.common.Base64Util; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.XmlUtil; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.security.SessionObject; import com.hai.common.utils.*; import com.hai.config.*; import com.hai.dao.HighGasOrderPushMapper; import com.hai.entity.*; import com.hai.enum_type.MerchantStoreSourceType; import com.hai.model.*; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContexts; import org.apache.http.util.EntityUtils; import org.bouncycastle.util.encoders.UrlBase64; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.util.IdGenerator; import org.springframework.web.bind.annotation.*; import sun.nio.cs.StreamEncoder; import javax.annotation.Resource; import javax.net.ssl.SSLContext; import javax.servlet.http.HttpServletRequest; import java.io.*; import java.math.BigDecimal; import java.nio.charset.StandardCharsets; import java.security.KeyStore; import java.util.*; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private HighMerchantService highMerchantService; @Resource private HighMerchantStoreService highMerchantStoreService; @Resource private HighGasOilPriceService highGasOilPriceService; @Resource private HighOrderService highOrderService; @Resource private HighProfitSharingRecordService highProfitSharingRecordService; @Resource private HighGasOilGunNoService gasOilGunNoService; @Resource private HighGasOrderPushMapper highGasOrderPushMapper; @Resource private HuiLianTongConfig huiLianTongConfig; @Resource private UnionPayConfig unionPayConfig; @Resource private UnionStagingPayConfig unionStagingPayConfig; @Resource private UnionUserConfig unionUserConfig; @Resource private OutRechargeOrderService outRechargeOrderService; @Resource private HighOilCardService oilCardService; @Resource private BaiduVoiceService baiduVoiceService; @Resource private MqttProviderConfig mqttProviderConfig; @Autowired private WebSocket webSocket; @Resource private ShellGroupService shellGroupService; @Resource private HighGasService gasService; @Resource private JinZhuJiaYouService jinZhuJiaYouService; @RequestMapping(value = "/spPrint", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "发送打印机消息") public ResponseData spPrint(@RequestParam(name = "orderNo", required = true) String orderNo, HttpServletRequest request) { try { HighOrder highOrder = highOrderService.getOrderByOrderNo(orderNo); for (HighChildOrder highChildOrder : highOrder.getHighChildOrderList()) { HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId()); new Thread(() -> { try { SpPrinterConfig sp = new SpPrinterConfig(); sp.print(store.getDeviceSn(), SpPrinterTemplate.oilCashierStubTemp( highChildOrder.getGoodsName(), highOrder.getOrderNo(), DateUtil.date2String(highOrder.getPayTime(), "yyyy-MM-dd HH:mm:ss"), "嗨森逛", highChildOrder.getGasGunNo(), highChildOrder.getGasOilNo(), highChildOrder.getGasOilLiters().toString(), highOrder.getTotalPrice().toString(), new HashMap<>(), false ), 1); Thread.sleep(6000); sp.print(store.getDeviceSn(), SpPrinterTemplate.oilClientStubTemp( highChildOrder.getGoodsName(), highOrder.getOrderNo(), DateUtil.date2String(highOrder.getPayTime(), "yyyy-MM-dd HH:mm:ss"), "嗨森逛", highChildOrder.getGasGunNo(), highChildOrder.getGasOilNo(), highChildOrder.getGasOilLiters().toString(), highOrder.getTotalPrice().toString(), new HashMap<>(), false ), 1); } catch (Exception e) { e.printStackTrace(); } }).start(); } return ResponseMsgUtil.success("发送成功"); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardInfo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryGasInfoByGasId", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据油站 id 拉取最新的油站数据") public ResponseData queryGasInfoByGasId(@RequestParam(name = "gasId", required = true) String gasId, HttpServletRequest request) { try { return ResponseMsgUtil.success(TuanYouConfig.queryGasInfoByGasId(gasId)); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardInfo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/initTYMerchantStore", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "初始化加油站") public ResponseData initTYMerchantStore(@RequestParam(name = "merchantId", required = true) Long merchantId) throws Exception { HighMerchantModel merchant = highMerchantService.getMerchantById(merchantId); if (merchant == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户"); } JSONObject jsonObjectP = TuanYouConfig.queryGasInfoListByPage(1, 1000); JSONObject resultObjectP = jsonObjectP.getObject("result", JSONObject.class); for (int i = 1; i <= resultObjectP.getInteger("totalPageNum").intValue(); i++) { JSONObject jsonObject = TuanYouConfig.queryGasInfoListByPage(i, 1000); JSONObject resultObject = jsonObject.getObject("result", JSONObject.class); JSONArray jsonArray = resultObject.getJSONArray("gasInfoList"); HighMerchantStore highMerchantStore; HighGasOilPrice highGasOilPrice; for (Object gasObject : jsonArray) { JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(gasObject)); HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreByKey(object.getString("gasId")); if (store != null) { store.setType(1); store.setMerchantId(merchant.getId()); store.setCompanyId(merchant.getCompanyId()); store.setStoreKey(object.getString("gasId")); store.setStoreName(object.getString("gasName")); store.setStoreLogo(object.getString("gasLogoSmall")); store.setRegionId(object.getLong("provinceCode")); store.setRegionName(object.getString("provinceName")); store.setAddress(object.getString("gasAddress")); store.setLongitude(object.getString("gasAddressLongitude")); store.setLatitude(object.getString("gasAddressLatitude")); store.setStatus(object.getInteger("gasStatus")); store.setOperatorId(0L); store.setOperatorName("系统创建"); store.setUpdateTime(new Date()); store.setExt1(object.getString("gasSourceId")); highMerchantStoreService.updateMerchantStoreDetail(store); JSONArray oilPriceList = object.getJSONArray("oilPriceList"); for (Object oilPrice : oilPriceList) { JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); // 查询门店油号 highGasOilPrice = highGasOilPriceService.getGasOilPriceByStoreAndOilNo(store.getId(), oilPriceObject.getInteger("oilNo")); if (highGasOilPrice == null) { highGasOilPrice = new HighGasOilPrice(); highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getInteger("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); } else { highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getInteger("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); } highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } else { highMerchantStore = new HighMerchantStore(); highMerchantStore.setType(1); highMerchantStore.setMerchantId(merchant.getId()); highMerchantStore.setCompanyId(merchant.getCompanyId()); highMerchantStore.setStoreKey(object.getString("gasId")); highMerchantStore.setStoreName(object.getString("gasName")); highMerchantStore.setStoreLogo(object.getString("gasLogoSmall")); highMerchantStore.setRegionId(object.getLong("provinceCode")); highMerchantStore.setRegionName(object.getString("provinceName")); highMerchantStore.setAddress(object.getString("gasAddress")); highMerchantStore.setLongitude(object.getString("gasAddressLongitude")); highMerchantStore.setLatitude(object.getString("gasAddressLatitude")); highMerchantStore.setStatus(1); highMerchantStore.setOperatorId(0L); highMerchantStore.setOperatorName("系统创建"); highMerchantStore.setCreateTime(new Date()); highMerchantStore.setUpdateTime(new Date()); highMerchantStore.setExt1(object.getString("gasSourceId")); HighMerchantStoreModel merchantStoreModel = new HighMerchantStoreModel(); BeanUtils.copyProperties(highMerchantStore, merchantStoreModel); highMerchantStoreService.insertMerchantStore(merchantStoreModel); JSONArray oilPriceList = object.getJSONArray("oilPriceList"); for (Object oilPrice : oilPriceList) { JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); highGasOilPrice = new HighGasOilPrice(); highGasOilPrice.setMerchantStoreId(merchantStoreModel.getId()); highGasOilPrice.setOilNo(oilPriceObject.getInteger("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } } } return ResponseMsgUtil.success("初始化完成"); } @RequestMapping(value = "/detectTYMerchantStore", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "检测加油站") public ResponseData detectTYMerchantStore(@RequestParam(name = "merchantId", required = true) Long merchantId) throws Exception { HighMerchantModel merchant = highMerchantService.getMerchantById(merchantId); if (merchant == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户"); } Map param = new HashMap<>(); param.put("merchantId", merchant.getId()); List stores = highMerchantStoreService.getMerchantStoreList(param); for (HighMerchantStore store : stores) { JSONObject jsonObject = TuanYouConfig.queryGasInfoByGasId(store.getStoreKey()); if (jsonObject != null && jsonObject.getString("code").equals("200")) { JSONObject result = jsonObject.getJSONObject("result"); store.setStatus(result.getInteger("gasStatus")); } else { store.setStatus(0); } highMerchantStoreService.updateMerchantStoreDetail(store); } return ResponseMsgUtil.success("初始化完成"); } /* @RequestMapping(value = "/pushTuanYouOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "推送团油订单") public ResponseData pushTuanYouOrder(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); for (HighChildOrder highChildOrder : order.getHighChildOrderList()) { HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId()); // 推送团油订单 Map paramMap = new HashMap<>(); paramMap.put("gasId", store.getStoreKey()); paramMap.put("oilNo", highChildOrder.getGasOilNo()); paramMap.put("gunNo", highChildOrder.getGasGunNo()); BigDecimal priceGun = highChildOrder.getGasPriceGun(); BigDecimal priceVip = highChildOrder.getGasPriceVip(); paramMap.put("priceGun", priceGun); // 枪单价 paramMap.put("priceVip", priceVip); // 优惠价 paramMap.put("driverPhone", order.getMemPhone()); // paramMap.put("driverPhone", "17726395120"); paramMap.put("thirdSerialNo", order.getOrderNo()); paramMap.put("refuelingAmount", highChildOrder.getTotalPrice()); // 油品类型 1:汽油:2:柴油;3:天然气 if (highChildOrder.getGasOilType() == 1) { paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouGasolineAccount()); } else if (highChildOrder.getGasOilType() == 2) { paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouDieselAccount()); } JSONObject orderPushObject = TuanYouConfig.refuelingOrderPush(paramMap); // 推送团油订单记录 HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); highGasOrderPush.setCreateTime(new Date()); highGasOrderPush.setCode(orderPushObject.getString("code")); highGasOrderPush.setRequestContent(JSONObject.toJSONString(paramMap)); highGasOrderPush.setReturnContent(orderPushObject.toJSONString()); highGasOrderPushMapper.insert(highGasOrderPush); if (orderPushObject != null && orderPushObject.getString("code").equals("200")) { highChildOrder.setGasOrderNo(orderPushObject.getJSONObject("result").getString("orderNo")); } highOrderService.updateOrder(order); } return ResponseMsgUtil.success(order); } catch (Exception e) { log.error("HighOrderController --> getOrderById() error!", e); return ResponseMsgUtil.exception(e); } } */ @RequestMapping(value = "/queryCompanyAccountInfo2JD", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询团油余额") public ResponseData queryCompanyAccountInfo2JD() { try { return ResponseMsgUtil.success(TuanYouConfig.queryCompanyAccountInfo2JD()); } catch (Exception e) { log.error("HighOrderController --> queryCompanyAccountInfo2JD() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryCompanyPriceDetail", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询团油余额") public ResponseData queryCompanyPriceDetail() { try { return ResponseMsgUtil.success(TuanYouConfig.queryCompanyPriceDetail("LW000115995", "92")); } catch (Exception e) { log.error("HighOrderController --> queryCompanyAccountInfo2JD() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/starbucksOrdersPay", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "星巴克支付") public ResponseData starbucksOrdersPay(@RequestParam(name = "orderNo", required = true) String orderNo) { try { return ResponseMsgUtil.success(QianZhuConfig.starbucksOrdersPay(orderNo)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/payKfcOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "肯德基支付") public ResponseData payKfcOrder(@RequestParam(name = "orderNo", required = true) String orderNo) { try { return ResponseMsgUtil.success(QianZhuConfig.payKfcOrder(orderNo)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/wxSplitAccount", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "微信分账") public ResponseData wxSplitAccount() { try { HighOrder orderNo = highOrderService.getOrderByOrderNo("HF2021101812025050304"); wxProfitsharing(orderNo.getOrderNo(), orderNo.getPaySerialNo(), orderNo.getPayRealPrice()); return ResponseMsgUtil.success("分账成功"); } catch (Exception e) { log.error("HighOrderController --> getOrderById() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryStaging", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "分期查询") public ResponseData queryStaging(@RequestParam(name = "oriOrgTrace", required = true) String oriOrgTrace, HttpServletRequest request) { try { String orgTrace = CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(0, 4) + CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length() - 4, CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length()) + DateUtil.format(new Date(), DateUtil.YMDHMS) + IDGenerator.nextId(6); return ResponseMsgUtil.success(UnionStagingPayConfig.queryStaging(orgTrace, oriOrgTrace, "", new Date(), request)); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } /* @RequestMapping(value = "/orderToRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "退款") public ResponseData orderToRefund(HttpServletRequest request) { try { OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund("4200001301202202035413938093", new BigDecimal("30.80"), new BigDecimal("16.90")); return ResponseMsgUtil.success(orderRefundModel); } catch (Exception e) { log.error("HighOrderController --> orderToRefund() error!", e); return ResponseMsgUtil.exception(e); } }*/ @RequestMapping(value = "/query", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "订单查询") public ResponseData query(@RequestParam(name = "oriOrgTrace", required = true) String oriOrgTrace, HttpServletRequest request) { try { String orgTrace = CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(0, 4) + CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length() - 4, CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length()) + DateUtil.format(new Date(), DateUtil.YMDHMS) + IDGenerator.nextId(6); return ResponseMsgUtil.success(UnionStagingPayConfig.query(orgTrace, oriOrgTrace, "", new Date(), request)); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } public void wxProfitsharing(String transaction_id, String out_order_no, BigDecimal amount) { try { Map param = new LinkedHashMap<>(); param.put("appid", "wx637bd6f7314daa46"); param.put("mch_id", "1289663601"); param.put("sub_mch_id", "1609882817"); // 个体户黎杨珍 param.put("transaction_id", transaction_id); param.put("out_order_no", out_order_no); param.put("nonce_str", WxUtils.makeNonStr()); // 分账金额 BigDecimal porofitSharingAmount = amount; List> receiversList = new ArrayList<>(); Map receiversMap = new LinkedHashMap<>(); receiversMap.put("type", "MERCHANT_ID"); receiversMap.put("account", "1603942866"); receiversMap.put("amount", porofitSharingAmount.multiply(new BigDecimal("100")).intValue()); receiversMap.put("description", "分给商户【惠昕石化】"); receiversList.add(receiversMap); param.put("receivers", JSONObject.toJSONString(receiversList)); String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5", WXPayConstants.SignType.HMACSHA256); param.put("sign", signStr); String resultXmL = this.doRefundRequest(param.get("mch_id"), null, WxUtils.mapToXml(param)); // 请求分账返回的结果 ResultProfitSharing resultProfitSharing = XmlUtil.getObjectFromXML(resultXmL, ResultProfitSharing.class); if (!resultProfitSharing.getResult_code().equals("FAIL")) { HighProfitSharingRecord sharingRecord = new HighProfitSharingRecord(); sharingRecord.setOutOrderNo(resultProfitSharing.getOut_order_no()); sharingRecord.setTransactionId(resultProfitSharing.getTransaction_id()); sharingRecord.setOrderId(resultProfitSharing.getOrder_id()); sharingRecord.setStatus(resultProfitSharing.getResult_code()); sharingRecord.setPrice(amount); sharingRecord.setCreateTime(new Date()); sharingRecord.setContent(resultXmL); highProfitSharingRecordService.insert(sharingRecord); } } catch (Exception e) { log.error("CmsContentController --> getCorporateAdvertising() error!", e); } } public CloseableHttpClient readCertificate(String mchId) throws Exception { /** * 注意PKCS12证书 是从微信商户平台-》账户设置-》 API安全 中下载的 */ KeyStore keyStore = KeyStore.getInstance("PKCS12"); //P12文件目录 证书路径,这里需要你自己修改,linux下还是windows下的根路径 FileInputStream instream = new FileInputStream("/home/project/wx_cert/1289663601_apiclient_cert.p12"); // FileInputStream instream = new FileInputStream("G:\\hurui-project/hai-parent/hai-service/src/main/java/privatekey/1289663601_apiclient_cert.p12"); try { keyStore.load(instream, "1289663601".toCharArray());//这里写密码..默认是你的MCHID } finally { instream.close(); } SSLContext sslcontext = SSLContexts.custom().loadKeyMaterial(keyStore, "1289663601".toCharArray()).build();//这里也是写密码的 SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext, SSLConnectionSocketFactory.getDefaultHostnameVerifier()); // Allow TLSv1 protocol only return HttpClients.custom().setSSLSocketFactory(sslsf).build(); } public String doRefundRequest(String mchId, String url, String data) throws Exception { //小程序退款需要调用双向证书的认证 CloseableHttpClient httpClient = readCertificate(mchId); try { HttpPost httpost = new HttpPost("https://api.mch.weixin.qq.com/secapi/pay/profitsharing"); // 设置响应头信息 httpost.addHeader("Connection", "keep-alive"); httpost.addHeader("Accept", "*/*"); httpost.addHeader("Content-Type", "text/xml"); httpost.addHeader("Host", "api.mch.weixin.qq.com"); httpost.addHeader("X-Requested-With", "XMLHttpRequest"); httpost.addHeader("Cache-Control", "max-age=0"); httpost.addHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) "); httpost.setEntity(new StringEntity(data, "UTF-8")); CloseableHttpResponse response = httpClient.execute(httpost); try { HttpEntity entity = response.getEntity(); String jsonStr = EntityUtils.toString(response.getEntity(), "UTF-8"); EntityUtils.consume(entity); return jsonStr; } finally { response.close(); } } catch (Exception e) { throw new RuntimeException(e); } finally { httpClient.close(); } } @RequestMapping(value = "/websocket", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "websocket") public ResponseData websocket(@RequestParam(name = "orderNo", required = true) String orderNo ) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); if (order.getHighChildOrderList().get(0).getGoodsType().equals(3)) { Map pushMsg = new HashMap<>(); pushMsg.put("userId", order.getHighChildOrderList().get(0).getGoodsId()); Map msgContent = new HashMap<>(); msgContent.put("order", highOrderService.getGasOrderDetail(order.getOrderNo())); msgContent.put("voice", baiduVoiceService.text2audio(order.getHighChildOrderList().get(0).getGoodsName() + "加油站,收款:" + order.getTotalPrice())); pushMsg.put("message", JSONObject.toJSONString(msgContent)); HttpsUtils.doPost("http://127.0.0.1:9901/msg/test/websocket", pushMsg, new HashMap<>()); } return ResponseMsgUtil.success("null"); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/gasStationQueryDetail", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "gasStationQueryDetail") public ResponseData gasStationQueryDetail() { try { return ResponseMsgUtil.success(shellGroupService.gasStationQueryDetail("0001")); } catch (Exception e) { log.error("HighOrderController --> gasStationQueryDetail() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/gasPageQueryAllStation", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "gasPageQueryAllStation") public ResponseData gasPageQueryAllStation() { try { gasService.getJiaHaoYouAllStation(); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighOrderController --> gasPageQueryAllStation() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/gasSyncPayment", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "gasSyncPayment") public ResponseData gasSyncPayment() { try { HighOrder order = highOrderService.getOrderByOrderNo("HF2022071114274054900"); for (HighChildOrder childOrder : order.getHighChildOrderList()) { HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(childOrder.getGoodsId()); // 推送壳牌 JSONObject syncPayment = shellGroupService.gasSyncPayment(order.getOrderNo(), // store.getStoreKey(), "0001", new Date(), order.getTotalPrice(), "92", "1", order.getPayRealPrice(), childOrder.getGasDiscount() ); } return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighOrderController --> gasPageQueryAllStation() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/gasSyncRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "gasSyncRefund") public ResponseData gasSyncRefund() { try { shellGroupService.gasSyncRefund(new Date(1659511289000L), "1659511289357"); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighOrderController --> gasSyncRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getJzStationListPage", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "getJzStationListPage") public ResponseData getJzStationListPage() { try { gasService.getJinZhuAllStation(); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighOrderController --> gasSyncRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/test", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "test") public ResponseData test() { try { JSONObject data = HuiLianTongUnionCardConfig.resolveResponse("Gbkl57c3fECXJRiCSOspjsb3bIyyFrE4TyMKKGsSAMzeXLElQQU00GoYZSYkJYg1G2Xlic2QvOd3\\nhJC7bc6qAg+9aoZr3IJi"); return ResponseMsgUtil.success(data); } catch (Exception e) { log.error("HighOrderController --> gasSyncRefund() error!", e); return ResponseMsgUtil.exception(e); } } public static String hexStringToString(String s) { if (s == null || s.equals("")) { return null; } s = s.replace(" ", ""); byte[] baKeyword = new byte[s.length() / 2]; for (int i = 0; i < baKeyword.length; i++) { try { baKeyword[i] = (byte) (0xff & Integer.parseInt(s.substring(i * 2, i * 2 + 2), 16)); } catch (Exception e) { e.printStackTrace(); } } try { s = new String(baKeyword, "UTF-8"); } catch (Exception e1) { e1.printStackTrace(); } return s; } /** * 获取打印内容,适用于云打印机 * * @param printText 打印文本 * @param pageCount 打印联数 * @param encodingStr 编码方式,默认UTF-8 * @return */ public byte[] getPrinterBytes(final byte[] printText, final int pageCount, String encodingStr) { try { byte[] array = new byte[printText.length + 9]; array[0] = 30; array[1] = 16; array[2] = (byte) pageCount;//打印份数 int num = array.length - 5; array[3] = (byte) (num >> 8); //array[4] = (byte)((uint)num & 0xFFu); array[4] = (byte) (num & 0xFF); for (int i = 0; i < printText.length; i++) { array[i + 5] = printText[i]; } array[array.length - 4] = 27; array[array.length - 3] = 99; byte[] crc16CodeArray = getCRC(printText); array[array.length - 2] = crc16CodeArray[0]; array[array.length - 1] = crc16CodeArray[1]; return array; /* if(encodingStr.equals("")){ encodingStr="UTF-8"; } byte[] msgByte = printText; // 消息数组 final byte[] dataByte = new byte[msgByte.length + 9]; dataByte[0] = 0x1E; dataByte[1] = 0x10; dataByte[2] = (byte) pageCount;// 打印多联 // 有效数据长度 final int len = dataByte.length - 5; dataByte[3] = (byte) (len >> 8); dataByte[4] = (byte) (len & 0xff); // 数据内容 System.arraycopy(msgByte, 0, dataByte, 5, msgByte.length); // 标识字节 dataByte[dataByte.length - 4] = 0x1b; dataByte[dataByte.length - 3] = 0x63; // 打印内容CRC校验 final byte[] dtCRC = getCRC(msgByte); dataByte[dataByte.length - 2] = (byte) (dtCRC[0]); dataByte[dataByte.length - 1] = (byte) (dtCRC[1]); msgByte = dataByte; return msgByte;*/ } catch (Exception ex) { System.out.println(ex.getStackTrace()); } return null; } /** * 获取打印内容,适用于云打印机 * * @param printText 打印文本 * @param pageCount 打印联数 * @param encodingStr 编码方式,默认UTF-8 * @return */ public byte[] getPrinterBytes(final String printText, final int pageCount, String encodingStr) { try { if (encodingStr.equals("")) { encodingStr = "UTF-8"; } byte[] msgByte = printText.getBytes(encodingStr); // 消息数组 final byte[] dataByte = new byte[msgByte.length + 9]; dataByte[0] = 0x1E; dataByte[1] = 0x10; dataByte[2] = (byte) pageCount;// 打印多联 // 有效数据长度 final int len = dataByte.length - 5; dataByte[3] = (byte) (len >> 8); dataByte[4] = (byte) (len & 0xff); // 数据内容 System.arraycopy(msgByte, 0, dataByte, 5, msgByte.length); // 标识字节 dataByte[dataByte.length - 4] = 0x1b; dataByte[dataByte.length - 3] = 0x63; // 打印内容CRC校验 final byte[] dtCRC = getCRC(msgByte); dataByte[dataByte.length - 2] = (byte) (dtCRC[0]); dataByte[dataByte.length - 1] = (byte) (dtCRC[1]); msgByte = dataByte; return msgByte; } catch (Exception ex) { System.out.println(ex.getStackTrace()); } return null; } private static int[] CRC16Table = {0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78}; private static byte[] getCRC(byte[] bytes) { int crc = 0xFFFF; // 初始值 for (byte b : bytes) { crc = (crc >> 8) ^ CRC16Table[(crc ^ b) & 0xff]; } byte[] b = new byte[2]; b[0] = (byte) ((crc >> 8) ^ 0xff); b[1] = (byte) ((crc & 0xff) ^ 0xff); return b; } private static final char[] HEXES = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; /** * byte数组 转换成 16进制小写字符串 */ private String bytes2Hex(byte[] bytes) { if (bytes == null || bytes.length == 0) { return null; } StringBuilder hex = new StringBuilder(); for (byte b : bytes) { hex.append(HEXES[(b >> 4) & 0x0F]); hex.append(HEXES[b & 0x0F]); } return hex.toString(); } @RequestMapping(value = "/insertV2", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "支付") public ResponseData insertV2() { try { String orderNo = "HF2022080818504922206"; JSONObject object = QianZhuConfig.insertV2("PLM100024", orderNo, "15585850137"); object.put("orderNo", orderNo); return ResponseMsgUtil.success(object); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/QueryV2", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询订单号") public ResponseData QueryV2(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); JSONObject orderObject = QianZhuConfig.QueryV2(orderNo); if (orderObject != null && orderObject.getLong("Code") == 999) { // 订单失败 // 订单状态 1:订单正在处理中 2;订单成功: 3 订单失败 if (orderObject.getJSONObject("Data").getInteger("OrderState") == 3) { // 订单失败 if (order.getOrderStatus() == 2) { highOrderService.thirdOrderToRefund(order.getId()); } else { highOrderService.thirdCancelOrder(order.getId()); } } // 订单状态 1:订单正在处理中 2;订单成功: 3 订单失败 if (orderObject.getJSONObject("Data").getInteger("OrderState") == 2) { for (HighChildOrder childOrder : order.getHighChildOrderList()) { childOrder.setChildOrdeStatus(3); } order.setOrderStatus(3); order.setFinishTime(new Date()); highOrderService.updateOrder(order); } } return ResponseMsgUtil.success(QianZhuConfig.QueryV2(orderNo)); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getKfcOrderByOrderNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询肯德基订单") public ResponseData getKfcOrderByOrderNo(@RequestParam(name = "orderNo", required = true) String orderNo) { try { return ResponseMsgUtil.success(QianZhuConfig.getKfcOrderByOrderNo(orderNo)); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/starbucksOrderByOrderNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询星巴克订单") public ResponseData starbucksOrderByOrderNo(@RequestParam(name = "orderNo", required = true) String orderNo) { try { return ResponseMsgUtil.success(QianZhuConfig.starbucksOrderByOrderNo(orderNo)); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/thirdOrderToRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "第三方退款") public ResponseData thirdOrderToRefund(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); highOrderService.thirdOrderToRefund(order.getId()); return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/rechargeOrderByCy", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "城宇话费充值 ") public ResponseData rechargeOrderByCy() { try { JSONObject object = new JSONObject(); object.put("mobile" , "18090580471"); object.put("productId" , 172); object.put("agentOrderId" , "RCG" + DateUtil.date2String(new Date(), "yyyyMMddHHmmss") + IDGenerator.nextId(5)); return ResponseMsgUtil.success(RechargeConfig.rechargeOrderByCy(object)); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryRechargeByCy", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "城宇查询订单") public ResponseData queryRechargeByCy(@RequestParam(name = "orderNo", required = true) String orderNo) { try { JSONObject object = new JSONObject(); object.put("orderNo" , orderNo); return ResponseMsgUtil.success(RechargeConfig.queryRechargeByCy(object)); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/postIp", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "请求ip地址") public ResponseData postIp(HttpServletRequest request) { try { request.getHeader("regionId"); if (request.getHeader("regionId") != null && request.getHeader("regionId").length() != 0) { System.out.println("111"); } return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsgcs.dctpay.com/brest/openApi/test")); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file + package com.cweb.controller; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.cweb.config.SysConst; import com.hai.common.Base64Util; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.XmlUtil; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.security.SessionObject; import com.hai.common.utils.*; import com.hai.config.*; import com.hai.dao.HighGasOrderPushMapper; import com.hai.entity.*; import com.hai.enum_type.MerchantStoreSourceType; import com.hai.model.*; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContexts; import org.apache.http.util.EntityUtils; import org.bouncycastle.util.encoders.UrlBase64; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.util.IdGenerator; import org.springframework.web.bind.annotation.*; import sun.nio.cs.StreamEncoder; import javax.annotation.Resource; import javax.net.ssl.SSLContext; import javax.servlet.http.HttpServletRequest; import java.io.*; import java.math.BigDecimal; import java.nio.charset.StandardCharsets; import java.security.KeyStore; import java.util.*; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private HighMerchantService highMerchantService; @Resource private HighMerchantStoreService highMerchantStoreService; @Resource private HighGasOilPriceService highGasOilPriceService; @Resource private HighOrderService highOrderService; @Resource private HighProfitSharingRecordService highProfitSharingRecordService; @Resource private HighGasOilGunNoService gasOilGunNoService; @Resource private HighGasOrderPushMapper highGasOrderPushMapper; @Resource private HuiLianTongConfig huiLianTongConfig; @Resource private UnionPayConfig unionPayConfig; @Resource private UnionStagingPayConfig unionStagingPayConfig; @Resource private UnionUserConfig unionUserConfig; @Resource private OutRechargeOrderService outRechargeOrderService; @Resource private HighOilCardService oilCardService; @Resource private BaiduVoiceService baiduVoiceService; @Resource private MqttProviderConfig mqttProviderConfig; @Autowired private WebSocket webSocket; @Resource private ShellGroupService shellGroupService; @Resource private HighGasService gasService; @Resource private JinZhuJiaYouService jinZhuJiaYouService; @RequestMapping(value = "/spPrint", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "发送打印机消息") public ResponseData spPrint(@RequestParam(name = "orderNo", required = true) String orderNo, HttpServletRequest request) { try { HighOrder highOrder = highOrderService.getOrderByOrderNo(orderNo); for (HighChildOrder highChildOrder : highOrder.getHighChildOrderList()) { HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId()); new Thread(() -> { try { SpPrinterConfig sp = new SpPrinterConfig(); sp.print(store.getDeviceSn(), SpPrinterTemplate.oilCashierStubTemp( highChildOrder.getGoodsName(), highOrder.getOrderNo(), DateUtil.date2String(highOrder.getPayTime(), "yyyy-MM-dd HH:mm:ss"), "嗨森逛", highChildOrder.getGasGunNo(), highChildOrder.getGasOilNo(), highChildOrder.getGasOilLiters().toString(), highOrder.getTotalPrice().toString(), new HashMap<>(), false ), 1); Thread.sleep(6000); sp.print(store.getDeviceSn(), SpPrinterTemplate.oilClientStubTemp( highChildOrder.getGoodsName(), highOrder.getOrderNo(), DateUtil.date2String(highOrder.getPayTime(), "yyyy-MM-dd HH:mm:ss"), "嗨森逛", highChildOrder.getGasGunNo(), highChildOrder.getGasOilNo(), highChildOrder.getGasOilLiters().toString(), highOrder.getTotalPrice().toString(), new HashMap<>(), false ), 1); } catch (Exception e) { e.printStackTrace(); } }).start(); } return ResponseMsgUtil.success("发送成功"); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardInfo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryGasInfoByGasId", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据油站 id 拉取最新的油站数据") public ResponseData queryGasInfoByGasId(@RequestParam(name = "gasId", required = true) String gasId, HttpServletRequest request) { try { return ResponseMsgUtil.success(TuanYouConfig.queryGasInfoByGasId(gasId)); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardInfo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/initTYMerchantStore", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "初始化加油站") public ResponseData initTYMerchantStore(@RequestParam(name = "merchantId", required = true) Long merchantId) throws Exception { HighMerchantModel merchant = highMerchantService.getMerchantById(merchantId); if (merchant == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户"); } JSONObject jsonObjectP = TuanYouConfig.queryGasInfoListByPage(1, 1000); JSONObject resultObjectP = jsonObjectP.getObject("result", JSONObject.class); for (int i = 1; i <= resultObjectP.getInteger("totalPageNum").intValue(); i++) { JSONObject jsonObject = TuanYouConfig.queryGasInfoListByPage(i, 1000); JSONObject resultObject = jsonObject.getObject("result", JSONObject.class); JSONArray jsonArray = resultObject.getJSONArray("gasInfoList"); HighMerchantStore highMerchantStore; HighGasOilPrice highGasOilPrice; for (Object gasObject : jsonArray) { JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(gasObject)); HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreByKey(object.getString("gasId")); if (store != null) { store.setType(1); store.setMerchantId(merchant.getId()); store.setCompanyId(merchant.getCompanyId()); store.setStoreKey(object.getString("gasId")); store.setStoreName(object.getString("gasName")); store.setStoreLogo(object.getString("gasLogoSmall")); store.setRegionId(object.getLong("provinceCode")); store.setRegionName(object.getString("provinceName")); store.setAddress(object.getString("gasAddress")); store.setLongitude(object.getString("gasAddressLongitude")); store.setLatitude(object.getString("gasAddressLatitude")); store.setStatus(object.getInteger("gasStatus")); store.setOperatorId(0L); store.setOperatorName("系统创建"); store.setUpdateTime(new Date()); store.setExt1(object.getString("gasSourceId")); highMerchantStoreService.updateMerchantStoreDetail(store); JSONArray oilPriceList = object.getJSONArray("oilPriceList"); for (Object oilPrice : oilPriceList) { JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); // 查询门店油号 highGasOilPrice = highGasOilPriceService.getGasOilPriceByStoreAndOilNo(store.getId(), oilPriceObject.getInteger("oilNo")); if (highGasOilPrice == null) { highGasOilPrice = new HighGasOilPrice(); highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getInteger("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); } else { highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getInteger("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); } highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } else { highMerchantStore = new HighMerchantStore(); highMerchantStore.setType(1); highMerchantStore.setMerchantId(merchant.getId()); highMerchantStore.setCompanyId(merchant.getCompanyId()); highMerchantStore.setStoreKey(object.getString("gasId")); highMerchantStore.setStoreName(object.getString("gasName")); highMerchantStore.setStoreLogo(object.getString("gasLogoSmall")); highMerchantStore.setRegionId(object.getLong("provinceCode")); highMerchantStore.setRegionName(object.getString("provinceName")); highMerchantStore.setAddress(object.getString("gasAddress")); highMerchantStore.setLongitude(object.getString("gasAddressLongitude")); highMerchantStore.setLatitude(object.getString("gasAddressLatitude")); highMerchantStore.setStatus(1); highMerchantStore.setOperatorId(0L); highMerchantStore.setOperatorName("系统创建"); highMerchantStore.setCreateTime(new Date()); highMerchantStore.setUpdateTime(new Date()); highMerchantStore.setExt1(object.getString("gasSourceId")); HighMerchantStoreModel merchantStoreModel = new HighMerchantStoreModel(); BeanUtils.copyProperties(highMerchantStore, merchantStoreModel); highMerchantStoreService.insertMerchantStore(merchantStoreModel); JSONArray oilPriceList = object.getJSONArray("oilPriceList"); for (Object oilPrice : oilPriceList) { JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); highGasOilPrice = new HighGasOilPrice(); highGasOilPrice.setMerchantStoreId(merchantStoreModel.getId()); highGasOilPrice.setOilNo(oilPriceObject.getInteger("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } } } return ResponseMsgUtil.success("初始化完成"); } @RequestMapping(value = "/detectTYMerchantStore", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "检测加油站") public ResponseData detectTYMerchantStore(@RequestParam(name = "merchantId", required = true) Long merchantId) throws Exception { HighMerchantModel merchant = highMerchantService.getMerchantById(merchantId); if (merchant == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户"); } Map param = new HashMap<>(); param.put("merchantId", merchant.getId()); List stores = highMerchantStoreService.getMerchantStoreList(param); for (HighMerchantStore store : stores) { JSONObject jsonObject = TuanYouConfig.queryGasInfoByGasId(store.getStoreKey()); if (jsonObject != null && jsonObject.getString("code").equals("200")) { JSONObject result = jsonObject.getJSONObject("result"); store.setStatus(result.getInteger("gasStatus")); } else { store.setStatus(0); } highMerchantStoreService.updateMerchantStoreDetail(store); } return ResponseMsgUtil.success("初始化完成"); } /* @RequestMapping(value = "/pushTuanYouOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "推送团油订单") public ResponseData pushTuanYouOrder(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); for (HighChildOrder highChildOrder : order.getHighChildOrderList()) { HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId()); // 推送团油订单 Map paramMap = new HashMap<>(); paramMap.put("gasId", store.getStoreKey()); paramMap.put("oilNo", highChildOrder.getGasOilNo()); paramMap.put("gunNo", highChildOrder.getGasGunNo()); BigDecimal priceGun = highChildOrder.getGasPriceGun(); BigDecimal priceVip = highChildOrder.getGasPriceVip(); paramMap.put("priceGun", priceGun); // 枪单价 paramMap.put("priceVip", priceVip); // 优惠价 paramMap.put("driverPhone", order.getMemPhone()); // paramMap.put("driverPhone", "17726395120"); paramMap.put("thirdSerialNo", order.getOrderNo()); paramMap.put("refuelingAmount", highChildOrder.getTotalPrice()); // 油品类型 1:汽油:2:柴油;3:天然气 if (highChildOrder.getGasOilType() == 1) { paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouGasolineAccount()); } else if (highChildOrder.getGasOilType() == 2) { paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouDieselAccount()); } JSONObject orderPushObject = TuanYouConfig.refuelingOrderPush(paramMap); // 推送团油订单记录 HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); highGasOrderPush.setCreateTime(new Date()); highGasOrderPush.setCode(orderPushObject.getString("code")); highGasOrderPush.setRequestContent(JSONObject.toJSONString(paramMap)); highGasOrderPush.setReturnContent(orderPushObject.toJSONString()); highGasOrderPushMapper.insert(highGasOrderPush); if (orderPushObject != null && orderPushObject.getString("code").equals("200")) { highChildOrder.setGasOrderNo(orderPushObject.getJSONObject("result").getString("orderNo")); } highOrderService.updateOrder(order); } return ResponseMsgUtil.success(order); } catch (Exception e) { log.error("HighOrderController --> getOrderById() error!", e); return ResponseMsgUtil.exception(e); } } */ @RequestMapping(value = "/queryCompanyAccountInfo2JD", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询团油余额") public ResponseData queryCompanyAccountInfo2JD() { try { return ResponseMsgUtil.success(TuanYouConfig.queryCompanyAccountInfo2JD()); } catch (Exception e) { log.error("HighOrderController --> queryCompanyAccountInfo2JD() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryCompanyPriceDetail", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询团油余额") public ResponseData queryCompanyPriceDetail() { try { return ResponseMsgUtil.success(TuanYouConfig.queryCompanyPriceDetail("LW000115995", "92")); } catch (Exception e) { log.error("HighOrderController --> queryCompanyAccountInfo2JD() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/starbucksOrdersPay", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "星巴克支付") public ResponseData starbucksOrdersPay(@RequestParam(name = "orderNo", required = true) String orderNo) { try { return ResponseMsgUtil.success(QianZhuConfig.starbucksOrdersPay(orderNo)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/payKfcOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "肯德基支付") public ResponseData payKfcOrder(@RequestParam(name = "orderNo", required = true) String orderNo) { try { return ResponseMsgUtil.success(QianZhuConfig.payKfcOrder(orderNo)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/wxSplitAccount", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "微信分账") public ResponseData wxSplitAccount() { try { HighOrder orderNo = highOrderService.getOrderByOrderNo("HF2021101812025050304"); wxProfitsharing(orderNo.getOrderNo(), orderNo.getPaySerialNo(), orderNo.getPayRealPrice()); return ResponseMsgUtil.success("分账成功"); } catch (Exception e) { log.error("HighOrderController --> getOrderById() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryStaging", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "分期查询") public ResponseData queryStaging(@RequestParam(name = "oriOrgTrace", required = true) String oriOrgTrace, HttpServletRequest request) { try { String orgTrace = CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(0, 4) + CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length() - 4, CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length()) + DateUtil.format(new Date(), DateUtil.YMDHMS) + IDGenerator.nextId(6); return ResponseMsgUtil.success(UnionStagingPayConfig.queryStaging(orgTrace, oriOrgTrace, "", new Date(), request)); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } /* @RequestMapping(value = "/orderToRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "退款") public ResponseData orderToRefund(HttpServletRequest request) { try { OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund("4200001301202202035413938093", new BigDecimal("30.80"), new BigDecimal("16.90")); return ResponseMsgUtil.success(orderRefundModel); } catch (Exception e) { log.error("HighOrderController --> orderToRefund() error!", e); return ResponseMsgUtil.exception(e); } }*/ @RequestMapping(value = "/query", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "订单查询") public ResponseData query(@RequestParam(name = "oriOrgTrace", required = true) String oriOrgTrace, HttpServletRequest request) { try { String orgTrace = CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(0, 4) + CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length() - 4, CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length()) + DateUtil.format(new Date(), DateUtil.YMDHMS) + IDGenerator.nextId(6); return ResponseMsgUtil.success(UnionStagingPayConfig.query(orgTrace, oriOrgTrace, "", new Date(), request)); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } public void wxProfitsharing(String transaction_id, String out_order_no, BigDecimal amount) { try { Map param = new LinkedHashMap<>(); param.put("appid", "wx637bd6f7314daa46"); param.put("mch_id", "1289663601"); param.put("sub_mch_id", "1609882817"); // 个体户黎杨珍 param.put("transaction_id", transaction_id); param.put("out_order_no", out_order_no); param.put("nonce_str", WxUtils.makeNonStr()); // 分账金额 BigDecimal porofitSharingAmount = amount; List> receiversList = new ArrayList<>(); Map receiversMap = new LinkedHashMap<>(); receiversMap.put("type", "MERCHANT_ID"); receiversMap.put("account", "1603942866"); receiversMap.put("amount", porofitSharingAmount.multiply(new BigDecimal("100")).intValue()); receiversMap.put("description", "分给商户【惠昕石化】"); receiversList.add(receiversMap); param.put("receivers", JSONObject.toJSONString(receiversList)); String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5", WXPayConstants.SignType.HMACSHA256); param.put("sign", signStr); String resultXmL = this.doRefundRequest(param.get("mch_id"), null, WxUtils.mapToXml(param)); // 请求分账返回的结果 ResultProfitSharing resultProfitSharing = XmlUtil.getObjectFromXML(resultXmL, ResultProfitSharing.class); if (!resultProfitSharing.getResult_code().equals("FAIL")) { HighProfitSharingRecord sharingRecord = new HighProfitSharingRecord(); sharingRecord.setOutOrderNo(resultProfitSharing.getOut_order_no()); sharingRecord.setTransactionId(resultProfitSharing.getTransaction_id()); sharingRecord.setOrderId(resultProfitSharing.getOrder_id()); sharingRecord.setStatus(resultProfitSharing.getResult_code()); sharingRecord.setPrice(amount); sharingRecord.setCreateTime(new Date()); sharingRecord.setContent(resultXmL); highProfitSharingRecordService.insert(sharingRecord); } } catch (Exception e) { log.error("CmsContentController --> getCorporateAdvertising() error!", e); } } public CloseableHttpClient readCertificate(String mchId) throws Exception { /** * 注意PKCS12证书 是从微信商户平台-》账户设置-》 API安全 中下载的 */ KeyStore keyStore = KeyStore.getInstance("PKCS12"); //P12文件目录 证书路径,这里需要你自己修改,linux下还是windows下的根路径 FileInputStream instream = new FileInputStream("/home/project/wx_cert/1289663601_apiclient_cert.p12"); // FileInputStream instream = new FileInputStream("G:\\hurui-project/hai-parent/hai-service/src/main/java/privatekey/1289663601_apiclient_cert.p12"); try { keyStore.load(instream, "1289663601".toCharArray());//这里写密码..默认是你的MCHID } finally { instream.close(); } SSLContext sslcontext = SSLContexts.custom().loadKeyMaterial(keyStore, "1289663601".toCharArray()).build();//这里也是写密码的 SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext, SSLConnectionSocketFactory.getDefaultHostnameVerifier()); // Allow TLSv1 protocol only return HttpClients.custom().setSSLSocketFactory(sslsf).build(); } public String doRefundRequest(String mchId, String url, String data) throws Exception { //小程序退款需要调用双向证书的认证 CloseableHttpClient httpClient = readCertificate(mchId); try { HttpPost httpost = new HttpPost("https://api.mch.weixin.qq.com/secapi/pay/profitsharing"); // 设置响应头信息 httpost.addHeader("Connection", "keep-alive"); httpost.addHeader("Accept", "*/*"); httpost.addHeader("Content-Type", "text/xml"); httpost.addHeader("Host", "api.mch.weixin.qq.com"); httpost.addHeader("X-Requested-With", "XMLHttpRequest"); httpost.addHeader("Cache-Control", "max-age=0"); httpost.addHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) "); httpost.setEntity(new StringEntity(data, "UTF-8")); CloseableHttpResponse response = httpClient.execute(httpost); try { HttpEntity entity = response.getEntity(); String jsonStr = EntityUtils.toString(response.getEntity(), "UTF-8"); EntityUtils.consume(entity); return jsonStr; } finally { response.close(); } } catch (Exception e) { throw new RuntimeException(e); } finally { httpClient.close(); } } @RequestMapping(value = "/websocket", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "websocket") public ResponseData websocket(@RequestParam(name = "orderNo", required = true) String orderNo ) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); if (order.getHighChildOrderList().get(0).getGoodsType().equals(3)) { Map pushMsg = new HashMap<>(); pushMsg.put("userId", order.getHighChildOrderList().get(0).getGoodsId()); Map msgContent = new HashMap<>(); msgContent.put("order", highOrderService.getGasOrderDetail(order.getOrderNo())); msgContent.put("voice", baiduVoiceService.text2audio(order.getHighChildOrderList().get(0).getGoodsName() + "加油站,收款:" + order.getTotalPrice())); pushMsg.put("message", JSONObject.toJSONString(msgContent)); HttpsUtils.doPost("http://127.0.0.1:9901/msg/test/websocket", pushMsg, new HashMap<>()); } return ResponseMsgUtil.success("null"); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/gasStationQueryDetail", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "gasStationQueryDetail") public ResponseData gasStationQueryDetail() { try { return ResponseMsgUtil.success(shellGroupService.gasStationQueryDetail("0001")); } catch (Exception e) { log.error("HighOrderController --> gasStationQueryDetail() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/gasPageQueryAllStation", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "gasPageQueryAllStation") public ResponseData gasPageQueryAllStation() { try { gasService.getJiaHaoYouAllStation(); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighOrderController --> gasPageQueryAllStation() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/gasSyncPayment", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "gasSyncPayment") public ResponseData gasSyncPayment() { try { HighOrder order = highOrderService.getOrderByOrderNo("HF2022071114274054900"); for (HighChildOrder childOrder : order.getHighChildOrderList()) { HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(childOrder.getGoodsId()); // 推送壳牌 JSONObject syncPayment = shellGroupService.gasSyncPayment(order.getOrderNo(), // store.getStoreKey(), "0001", new Date(), order.getTotalPrice(), "92", "1", order.getPayRealPrice(), childOrder.getGasDiscount() ); } return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighOrderController --> gasPageQueryAllStation() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/gasSyncRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "gasSyncRefund") public ResponseData gasSyncRefund() { try { shellGroupService.gasSyncRefund(new Date(1659511289000L), "1659511289357"); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighOrderController --> gasSyncRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getJzStationListPage", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "getJzStationListPage") public ResponseData getJzStationListPage() { try { gasService.getJinZhuAllStation(); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighOrderController --> gasSyncRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/test", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "test") public ResponseData test() { try { JSONObject data = HuiLianTongUnionCardConfig.resolveResponse("Gbkl57c3fECXJRiCSOspjsb3bIyyFrE4TyMKKGsSAMzeXLElQQU00GoYZSYkJYg1G2Xlic2QvOd3\\nhJC7bc6qAg+9aoZr3IJi"); return ResponseMsgUtil.success(data); } catch (Exception e) { log.error("HighOrderController --> gasSyncRefund() error!", e); return ResponseMsgUtil.exception(e); } } public static String hexStringToString(String s) { if (s == null || s.equals("")) { return null; } s = s.replace(" ", ""); byte[] baKeyword = new byte[s.length() / 2]; for (int i = 0; i < baKeyword.length; i++) { try { baKeyword[i] = (byte) (0xff & Integer.parseInt(s.substring(i * 2, i * 2 + 2), 16)); } catch (Exception e) { e.printStackTrace(); } } try { s = new String(baKeyword, "UTF-8"); } catch (Exception e1) { e1.printStackTrace(); } return s; } /** * 获取打印内容,适用于云打印机 * * @param printText 打印文本 * @param pageCount 打印联数 * @param encodingStr 编码方式,默认UTF-8 * @return */ public byte[] getPrinterBytes(final byte[] printText, final int pageCount, String encodingStr) { try { byte[] array = new byte[printText.length + 9]; array[0] = 30; array[1] = 16; array[2] = (byte) pageCount;//打印份数 int num = array.length - 5; array[3] = (byte) (num >> 8); //array[4] = (byte)((uint)num & 0xFFu); array[4] = (byte) (num & 0xFF); for (int i = 0; i < printText.length; i++) { array[i + 5] = printText[i]; } array[array.length - 4] = 27; array[array.length - 3] = 99; byte[] crc16CodeArray = getCRC(printText); array[array.length - 2] = crc16CodeArray[0]; array[array.length - 1] = crc16CodeArray[1]; return array; /* if(encodingStr.equals("")){ encodingStr="UTF-8"; } byte[] msgByte = printText; // 消息数组 final byte[] dataByte = new byte[msgByte.length + 9]; dataByte[0] = 0x1E; dataByte[1] = 0x10; dataByte[2] = (byte) pageCount;// 打印多联 // 有效数据长度 final int len = dataByte.length - 5; dataByte[3] = (byte) (len >> 8); dataByte[4] = (byte) (len & 0xff); // 数据内容 System.arraycopy(msgByte, 0, dataByte, 5, msgByte.length); // 标识字节 dataByte[dataByte.length - 4] = 0x1b; dataByte[dataByte.length - 3] = 0x63; // 打印内容CRC校验 final byte[] dtCRC = getCRC(msgByte); dataByte[dataByte.length - 2] = (byte) (dtCRC[0]); dataByte[dataByte.length - 1] = (byte) (dtCRC[1]); msgByte = dataByte; return msgByte;*/ } catch (Exception ex) { System.out.println(ex.getStackTrace()); } return null; } /** * 获取打印内容,适用于云打印机 * * @param printText 打印文本 * @param pageCount 打印联数 * @param encodingStr 编码方式,默认UTF-8 * @return */ public byte[] getPrinterBytes(final String printText, final int pageCount, String encodingStr) { try { if (encodingStr.equals("")) { encodingStr = "UTF-8"; } byte[] msgByte = printText.getBytes(encodingStr); // 消息数组 final byte[] dataByte = new byte[msgByte.length + 9]; dataByte[0] = 0x1E; dataByte[1] = 0x10; dataByte[2] = (byte) pageCount;// 打印多联 // 有效数据长度 final int len = dataByte.length - 5; dataByte[3] = (byte) (len >> 8); dataByte[4] = (byte) (len & 0xff); // 数据内容 System.arraycopy(msgByte, 0, dataByte, 5, msgByte.length); // 标识字节 dataByte[dataByte.length - 4] = 0x1b; dataByte[dataByte.length - 3] = 0x63; // 打印内容CRC校验 final byte[] dtCRC = getCRC(msgByte); dataByte[dataByte.length - 2] = (byte) (dtCRC[0]); dataByte[dataByte.length - 1] = (byte) (dtCRC[1]); msgByte = dataByte; return msgByte; } catch (Exception ex) { System.out.println(ex.getStackTrace()); } return null; } private static int[] CRC16Table = {0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78}; private static byte[] getCRC(byte[] bytes) { int crc = 0xFFFF; // 初始值 for (byte b : bytes) { crc = (crc >> 8) ^ CRC16Table[(crc ^ b) & 0xff]; } byte[] b = new byte[2]; b[0] = (byte) ((crc >> 8) ^ 0xff); b[1] = (byte) ((crc & 0xff) ^ 0xff); return b; } private static final char[] HEXES = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; /** * byte数组 转换成 16进制小写字符串 */ private String bytes2Hex(byte[] bytes) { if (bytes == null || bytes.length == 0) { return null; } StringBuilder hex = new StringBuilder(); for (byte b : bytes) { hex.append(HEXES[(b >> 4) & 0x0F]); hex.append(HEXES[b & 0x0F]); } return hex.toString(); } @RequestMapping(value = "/insertV2", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "支付") public ResponseData insertV2() { try { String orderNo = "HF2022080818504922206"; JSONObject object = QianZhuConfig.insertV2("PLM100024", orderNo, "15585850137"); object.put("orderNo", orderNo); return ResponseMsgUtil.success(object); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/QueryV2", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询订单号") public ResponseData QueryV2(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); JSONObject orderObject = QianZhuConfig.QueryV2(orderNo); if (orderObject != null && orderObject.getLong("Code") == 999) { // 订单失败 // 订单状态 1:订单正在处理中 2;订单成功: 3 订单失败 if (orderObject.getJSONObject("Data").getInteger("OrderState") == 3) { // 订单失败 if (order.getOrderStatus() == 2) { highOrderService.thirdOrderToRefund(order.getId()); } else { highOrderService.thirdCancelOrder(order.getId()); } } // 订单状态 1:订单正在处理中 2;订单成功: 3 订单失败 if (orderObject.getJSONObject("Data").getInteger("OrderState") == 2) { for (HighChildOrder childOrder : order.getHighChildOrderList()) { childOrder.setChildOrdeStatus(3); } order.setOrderStatus(3); order.setFinishTime(new Date()); highOrderService.updateOrder(order); } } return ResponseMsgUtil.success(QianZhuConfig.QueryV2(orderNo)); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getKfcOrderByOrderNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询肯德基订单") public ResponseData getKfcOrderByOrderNo(@RequestParam(name = "orderNo", required = true) String orderNo) { try { return ResponseMsgUtil.success(QianZhuConfig.getKfcOrderByOrderNo(orderNo)); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/starbucksOrderByOrderNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询星巴克订单") public ResponseData starbucksOrderByOrderNo(@RequestParam(name = "orderNo", required = true) String orderNo) { try { return ResponseMsgUtil.success(QianZhuConfig.starbucksOrderByOrderNo(orderNo)); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/thirdOrderToRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "第三方退款") public ResponseData thirdOrderToRefund(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); highOrderService.thirdOrderToRefund(order.getId()); return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/rechargeOrderByCy", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "城宇话费充值 ") public ResponseData rechargeOrderByCy() { try { JSONObject object = new JSONObject(); object.put("mobile" , "18090580471"); object.put("productId" , 172); object.put("agentOrderId" , "RCG" + DateUtil.date2String(new Date(), "yyyyMMddHHmmss") + IDGenerator.nextId(5)); return ResponseMsgUtil.success(RechargeConfig.rechargeOrderByCy(object)); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryRechargeByCy", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "城宇查询订单") public ResponseData queryRechargeByCy(@RequestParam(name = "orderNo", required = true) String orderNo) { try { JSONObject object = new JSONObject(); object.put("orderNo" , orderNo); return ResponseMsgUtil.success(RechargeConfig.queryRechargeByCy(object)); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/postIp", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "请求ip地址") public ResponseData postIp(HttpServletRequest request) { try { request.getHeader("regionId"); if (request.getHeader("regionId") != null && request.getHeader("regionId").length() != 0) { System.out.println("111"); } return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsgcs.dctpay.com/brest/openApi/test")); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighUserCommonController.java b/hai-cweb/src/main/java/com/cweb/controller/HighUserCommonController.java index e29f8ce7..5c9fffb6 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighUserCommonController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighUserCommonController.java @@ -55,6 +55,8 @@ public class HighUserCommonController { @ApiOperation(value = "登录接口【用户不存在会自动注册】") public ResponseData login(@RequestParam(value = "phone", required = true) String phone, @RequestParam(value = "code", required = true) String code, + @RequestParam(value = "popularizeUserId", required = false) Long popularizeUserId, + @RequestParam(value = "regionId", required = false) String regionId, HttpServletRequest request, HttpServletResponse response) { try { @@ -80,7 +82,8 @@ public class HighUserCommonController { // 1:需要填写用户信息 // 2:需要填写手机号 user.setInfoCompleteStatus(1); - highUserService.insertUser(user); + + highUserService.insertUser(user , popularizeUserId , regionId); } HighUserModel highUserModel = new HighUserModel(); @@ -99,6 +102,8 @@ public class HighUserCommonController { @ResponseBody @ApiOperation(value = "银联授权手机号登录接口") public ResponseData unionPhoneLogin(@RequestParam(value = "code", required = true) String code, + @RequestParam(value = "popularizeUserId", required = false) Long popularizeUserId, + @RequestParam(value = "regionId", required = false) String regionId, HttpServletRequest request, HttpServletResponse response) { try { @@ -133,7 +138,7 @@ public class HighUserCommonController { // 1:需要填写用户信息 // 2:需要填写手机号 user.setInfoCompleteStatus(1); - highUserService.insertUser(user); + highUserService.insertUser(user , popularizeUserId , regionId); } else { user.setUnionOpenId(token.getJSONObject("params").getString("openId")); user.setUnionUnionId(token.getJSONObject("params").getString("unionId")); diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java b/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java index c077b8b0..6a0fa5ae 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java @@ -1,12 +1,17 @@ package com.cweb.controller; import com.alibaba.fastjson.JSONObject; +import com.cweb.config.SysConst; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.security.*; +import com.hai.common.utils.ImageUtils; import com.hai.common.utils.RedisUtil; import com.hai.common.utils.ResponseMsgUtil; +import com.hai.config.CommonConfig; import com.hai.entity.HighOrder; import com.hai.entity.HighUser; import com.hai.entity.HighUserCoupon; @@ -27,6 +32,8 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.util.HashMap; +import java.util.Map; import java.util.Objects; /** @@ -53,6 +60,12 @@ public class HighUserController { @Resource private HltUnionCardVipService hltUnionCardVipService; + @Resource + private BsDistributionUserRelService bsDistributionUserRelService; + + @Resource + private HighOrderService highOrderService; + @Resource private RedisUtil redisUtil; @@ -267,4 +280,101 @@ public class HighUserController { } } + @RequestMapping(value = "/userDistributionStatistics", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询分销用户统计内容") + public ResponseData userDistributionStatistics(HttpServletRequest request) { + try { + // 用户 + SessionObject sessionObject = userCenter.getSessionObject(request); + HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); + return ResponseMsgUtil.success(bsDistributionUserRelService.userDistributionStatistics(userInfoModel.getHighUser().getId())); + } catch (Exception e) { + log.error("HighOrderController --> getBackendToken() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/distributionInviteList", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询分销用户邀请列表") + public ResponseData distributionInviteList(HttpServletRequest request, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize) { + try { + // 用户 + SessionObject sessionObject = userCenter.getSessionObject(request); + HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); + + Map map = new HashMap<>(); + map.put("popularizeUserId" , userInfoModel.getHighUser().getId()); + + + PageHelper.startPage(pageNum,pageSize); + return ResponseMsgUtil.success(new PageInfo<>(bsDistributionUserRelService.getDistributionUserRelList(map))); + } catch (Exception e) { + log.error("HighOrderController --> getBackendToken() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/distributionOrderList", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询分销用户积分列表") + public ResponseData distributionOrderList(HttpServletRequest request, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize) { + try { + // 用户 + SessionObject sessionObject = userCenter.getSessionObject(request); + HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); + + Map map = new HashMap<>(); + map.put("popularizeUserId" , userInfoModel.getHighUser().getId()); + PageHelper.startPage(pageNum,pageSize); + return ResponseMsgUtil.success(new PageInfo<>(bsDistributionUserRelService.getDistributionRebateList(map))); + } catch (Exception e) { + log.error("HighOrderController --> getBackendToken() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/promotionalPosters", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "生成推广海报") + public ResponseData promotionalPosters(HttpServletRequest request) { + try { + // 用户 + SessionObject sessionObject = userCenter.getSessionObject(request); + HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); + + String path = ImageUtils.QrCodeImg(SysConst.getSysConfig().getQrCodeUrl() , userInfoModel.getHighUser().getId().intValue()); + + CommonConfig.overlapImage(path , userInfoModel.getHighUser().getId().toString()); + + return ResponseMsgUtil.success(SysConst.getSysConfig().getImgUrl() + path); + } catch (Exception e) { + log.error("HighOrderController --> getBackendToken() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/promoteOrderList", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询用户推广列表") + public ResponseData promoteOrderList(HttpServletRequest request, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize) { + try { + // 用户 + SessionObject sessionObject = userCenter.getSessionObject(request); + HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); + + PageHelper.startPage(pageNum,pageSize); + return ResponseMsgUtil.success(new PageInfo<>(highOrderService.promoteOrderList(userInfoModel.getHighUser().getId()))); + } catch (Exception e) { + log.error("HighOrderController --> getBackendToken() error!", e); + return ResponseMsgUtil.exception(e); + } + } } diff --git a/hai-cweb/src/main/java/com/cweb/controller/WechatController.java b/hai-cweb/src/main/java/com/cweb/controller/WechatController.java index bfa8bf3e..5de9c0b8 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/WechatController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/WechatController.java @@ -54,9 +54,6 @@ public class WechatController { @Resource private HighUserService highUserService; - @Resource - private HighUserPayPasswordService highUserPayPasswordService; - @Resource private RedisUtil redisUtil; @@ -89,6 +86,8 @@ public class WechatController { public ResponseData loginByPhone(@RequestParam(value = "encryptedData", required = true) String encryptedData, @RequestParam(value = "iv", required = true) String iv, @RequestParam(value = "openId", required = true) String openId, + @RequestParam(value = "popularizeUserId", required = false) Long popularizeUserId, + @RequestParam(value = "regionId", required = false) String regionId, HttpServletRequest request, HttpServletResponse response) { try { log.error("origin encryptedData:" + encryptedData + ";iv:" + iv); @@ -130,7 +129,7 @@ public class WechatController { // 1:需要填写用户信息 // 2:需要填写手机号 user.setInfoCompleteStatus(1); - highUserService.insertUser(user); + highUserService.insertUser(user , popularizeUserId , regionId); } else { if (session.getOpenid() == null) { user.setOpenId(session.getOpenid()); @@ -248,10 +247,20 @@ public class WechatController { @ApiOperation(value = "根据手机号码登陆") public ResponseData loginByTel(@RequestParam(value = "phone", required = true) String phone, @RequestParam(value = "code", required = true) String code, + @RequestParam(value = "popularizeUserId", required = false) Long popularizeUserId, + @RequestParam(value = "regionId", required = false) String regionId, HttpServletRequest request, HttpServletResponse response) { try { + // 获取手机号验证码 + String phoneSmsCode = (String) redisUtil.get("SMS_"+ phone); + + // 验证码校验 + if (!(StringUtils.isNotBlank(phoneSmsCode) && Objects.equals(phoneSmsCode,code))) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "验证码错误"); + } + // 根据手机号查询用户 HighUser user = highUserService.findByPhone(phone); @@ -267,30 +276,60 @@ public class WechatController { // 1:需要填写用户信息 // 2:需要填写手机号 user.setInfoCompleteStatus(1); - highUserService.insertUser(user); + highUserService.insertUser(user , popularizeUserId , regionId); } + // 定义个人所有数据 + HighUserModel highUserModel = new HighUserModel(); + HighUser detailData = highUserService.getDetailDataByUser(user.getId()); + detailData.setPassword(null); + highUserModel.setHighUser(detailData); + SessionObject so = new SessionObject(user.getPhone(), 1, highUserModel); + userCenter.save(request, response, so); + return ResponseMsgUtil.success(so); - // 获取手机号验证码 - String phoneSmsCode = (String) redisUtil.get("SMS_"+ phone); + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } - // 验证码校验 - if (StringUtils.isNotBlank(phoneSmsCode) && Objects.equals(phoneSmsCode,code)) { - // 定义个人所有数据 - HighUserModel highUserModel = new HighUserModel(); - HighUser detailData = highUserService.getDetailDataByUser(user.getId()); - detailData.setPassword(null); - highUserModel.setHighUser(detailData); - SessionObject so = new SessionObject(user.getPhone(), 1, highUserModel); - userCenter.save(request, response, so); - return ResponseMsgUtil.success(so); - } else { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "验证码错误"); - } + @RequestMapping(value = "/loginBySilence", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "根据手机号码登陆") + public ResponseData loginByTel(@RequestParam(value = "phone", required = true) String phone, + HttpServletRequest request, HttpServletResponse response) { + try { + // 根据手机号查询用户 + HighUser user = highUserService.findByPhone(phone); + + if (user == null) { + user = new HighUser(); + user.setName("用户" + IDGenerator.nextId(5)); + user.setPhone(phone); + user.setRegTime(new Date()); + user.setGold(0); + user.setStatus(1); + // 用户信息完整状态 + // 0:完整 + // 1:需要填写用户信息 + // 2:需要填写手机号 + user.setInfoCompleteStatus(1); + highUserService.insertUser(user , null , null); + } + + // 定义个人所有数据 + HighUserModel highUserModel = new HighUserModel(); + HighUser detailData = highUserService.getDetailDataByUser(user.getId()); + detailData.setPassword(null); + highUserModel.setHighUser(detailData); + SessionObject so = new SessionObject(user.getPhone(), 1, highUserModel); + userCenter.save(request, response, so); + return ResponseMsgUtil.success(so); } catch (Exception e) { return ResponseMsgUtil.exception(e); } } + } diff --git a/hai-cweb/src/main/resources/dev/config.properties b/hai-cweb/src/main/resources/dev/config.properties index 657c7733..64ff8af1 100644 --- a/hai-cweb/src/main/resources/dev/config.properties +++ b/hai-cweb/src/main/resources/dev/config.properties @@ -23,3 +23,5 @@ imgUrl=https://hsgcs.dctpay.com/filesystem/ fileUrl=/home/project/hsg/filesystem cmsPath=/home/project/hsg/filesystem/cmsPath couponCodePath=/home/project/hsg/filesystem/couponCode + +qrCodeUrl=https://hsgcs.dctpay.com/hsgH5?accountId=0000010&key=&code= diff --git a/hai-cweb/src/main/resources/prod-9401/config.properties b/hai-cweb/src/main/resources/prod-9401/config.properties index ed2c6c16..d44e4cd4 100644 --- a/hai-cweb/src/main/resources/prod-9401/config.properties +++ b/hai-cweb/src/main/resources/prod-9401/config.properties @@ -21,3 +21,6 @@ imgUrl=https://hsg.dctpay.com/filesystem/ fileUrl=/home/project/hsg/filesystem cmsPath=/home/project/hsg/filesystem/cmsPath couponCodePath=/home/project/hsg/filesystem/couponCode + + +qrCodeUrl=https://hsg.dctpay.com/hsgH5?accountId=0000010&key=&code= diff --git a/hai-cweb/src/main/resources/prod/config.properties b/hai-cweb/src/main/resources/prod/config.properties index 6ad1b7f2..a6895eca 100644 --- a/hai-cweb/src/main/resources/prod/config.properties +++ b/hai-cweb/src/main/resources/prod/config.properties @@ -23,3 +23,6 @@ imgUrl=https://hsg.dctpay.com/filesystem/ fileUrl=/home/project/hsg/filesystem cmsPath=/home/project/hsg/filesystem/cmsPath couponCodePath=/home/project/hsg/filesystem/couponCode + + +qrCodeUrl=https://hsg.dctpay.com/hsgH5?accountId=0000010&key=&code= diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java index 8426151c..eb9e7af7 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java @@ -431,6 +431,14 @@ public class HighOrderSchedule { } } } + /** + * @Author Sum1Dream + * @name integralRebateOrder.java + * @Description // 执行返利操作 + * @Date 15:13 2022/8/22 + * @Param [] + * @return void + */ @Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次 public void integralRebateOrder() { List order = highOrderService.integralRebateOrder(); @@ -446,6 +454,7 @@ public class HighOrderSchedule { if (goldRecs.size() == 0) { List childOrderList = highOrderService.getChildOrderByOrder(highOrder.getId()); + // 查询订单来源 JSONObject object = highOrderService.orderSource(childOrderList.get(0).getGoodsType() , childOrderList.get(0).getGoodsId(),highOrder.getOrderNo() , highOrder.getCompanyId()); object.put("price" , highOrder.getPayRealPrice()); diff --git a/hai-service/src/main/java/com/hai/common/QRCodeGenerator.java b/hai-service/src/main/java/com/hai/common/QRCodeGenerator.java index 7ac839f9..ce60a9a2 100644 --- a/hai-service/src/main/java/com/hai/common/QRCodeGenerator.java +++ b/hai-service/src/main/java/com/hai/common/QRCodeGenerator.java @@ -32,14 +32,4 @@ public class QRCodeGenerator { } - public static void main(String[] args) { - try { - generateQRCodeImage("This is my first QR Code", 350, 350, "D:\\/ss/qr1.png"); - } catch (WriterException e) { - System.out.println("Could not generate QR Code, WriterException :: " + e.getMessage()); - } catch (IOException e) { - System.out.println("Could not generate QR Code, IOException :: " + e.getMessage()); - } - - } } diff --git a/hai-service/src/main/java/com/hai/common/utils/ImageUtils.java b/hai-service/src/main/java/com/hai/common/utils/ImageUtils.java new file mode 100644 index 00000000..993e4c85 --- /dev/null +++ b/hai-service/src/main/java/com/hai/common/utils/ImageUtils.java @@ -0,0 +1,307 @@ +package com.hai.common.utils; + + +import com.hai.common.QRCodeGenerator; +import com.hai.config.CommonSysConst; +import sun.misc.BASE64Decoder; +import sun.misc.BASE64Encoder; + +import javax.imageio.ImageIO; +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.Objects; + +/** + * 图片处理 + */ +public class ImageUtils { + + public static void main(String[] args) throws Exception { + String a = ImageToBase64ByOnline("https://oos.jyfwy.cn/common/test/test20210511.jpg"); + System.out.println(a); + } + + public static String transferAlphaForHttp(InputStream inputStream){ + try { + byte[] data = transferAlpha(null,inputStream,130); + return byteArrayToBase64(data); + }catch (Exception e){ + e.printStackTrace(); + } + return ""; + } + + public static String byteArrayToBase64(byte[] bytes) { + BASE64Encoder encoder = new BASE64Encoder(); + String png_base64 = encoder.encodeBuffer(bytes).trim();//转换成base64串 + png_base64 = png_base64.replaceAll("\n", "").replaceAll("\r", "");//删除 \r\n + System.out.println("值为:" + "data:image/jpg;base64," + png_base64); + return "data:image/jpg;base64," + png_base64; + } + + /** + * 图片去白色的背景,并裁切 + * + * @param image 图片 + * @param range 范围 1-255 越大 容错越高 去掉的背景越多 + * @return 图片 + * @throws Exception 异常 + */ + public static byte[] transferAlpha(Image image, InputStream in, int range) throws Exception { + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + try { + if (image == null && in != null) { + image = ImageIO.read(in); + } + ImageIcon imageIcon = new ImageIcon(image); + BufferedImage bufferedImage = new BufferedImage(imageIcon + .getIconWidth(), imageIcon.getIconHeight(), + BufferedImage.TYPE_4BYTE_ABGR); + Graphics2D g2D = (Graphics2D) bufferedImage.getGraphics(); + g2D.drawImage(imageIcon.getImage(), 0, 0, imageIcon + .getImageObserver()); + int alpha = 0; + int minX = bufferedImage.getWidth(); + int minY = bufferedImage.getHeight(); + int maxX = 0; + int maxY = 0; + + for (int j1 = bufferedImage.getMinY(); j1 < bufferedImage + .getHeight(); j1++) { + for (int j2 = bufferedImage.getMinX(); j2 < bufferedImage + .getWidth(); j2++) { + int rgb = bufferedImage.getRGB(j2, j1); + + int R = (rgb & 0xff0000) >> 16; + int G = (rgb & 0xff00) >> 8; + int B = (rgb & 0xff); + if (((255 - R) < range) && ((255 - G) < range) && ((255 - B) < range)) { //去除白色背景; + rgb = ((alpha + 1) << 24) | (rgb & 0x00ffffff); + } else { + minX = minX <= j2 ? minX : j2; + minY = minY <= j1 ? minY : j1; + maxX = maxX >= j2 ? maxX : j2; + maxY = maxY >= j1 ? maxY : j1; + } + bufferedImage.setRGB(j2, j1, rgb); + } + } + int width = maxX - minX; + int height = maxY - minY; + BufferedImage sub = bufferedImage.getSubimage(minX, minY, width, height); + ImageIO.write(sub, "png", byteArrayOutputStream); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + + return byteArrayOutputStream.toByteArray(); + } + + public static byte[] transferAlphaAndRotate(Image image, InputStream in, int range, double angel) throws Exception { + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + try { + if (image == null && in != null) { + image = ImageIO.read(in); + } + image = imageRotate(image,angel); + ImageIcon imageIcon = new ImageIcon(image); + BufferedImage bufferedImage = new BufferedImage(imageIcon + .getIconWidth(), imageIcon.getIconHeight(), + BufferedImage.TYPE_4BYTE_ABGR); + Graphics2D g2D = (Graphics2D) bufferedImage.getGraphics(); + g2D.drawImage(imageIcon.getImage(), 0, 0, imageIcon + .getImageObserver()); + int alpha = 0; + int minX = bufferedImage.getWidth(); + int minY = bufferedImage.getHeight(); + int maxX = 0; + int maxY = 0; + + for (int j1 = bufferedImage.getMinY(); j1 < bufferedImage + .getHeight(); j1++) { + for (int j2 = bufferedImage.getMinX(); j2 < bufferedImage + .getWidth(); j2++) { + int rgb = bufferedImage.getRGB(j2, j1); + + int R = (rgb & 0xff0000) >> 16; + int G = (rgb & 0xff00) >> 8; + int B = (rgb & 0xff); + if (((255 - R) < range) && ((255 - G) < range) && ((255 - B) < range)) { //去除白色背景; + rgb = ((alpha + 1) << 24) | (rgb & 0x00ffffff); + } else { + minX = minX <= j2 ? minX : j2; + minY = minY <= j1 ? minY : j1; + maxX = maxX >= j2 ? maxX : j2; + maxY = maxY >= j1 ? maxY : j1; + } + bufferedImage.setRGB(j2, j1, rgb); + } + } + int width = maxX - minX; + int height = maxY - minY; + BufferedImage sub = bufferedImage.getSubimage(minX, minY, width, height); + ImageIO.write(sub, "png", byteArrayOutputStream); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + + return byteArrayOutputStream.toByteArray(); + } + + /** + * 图像旋转 + * @param src + * @param angel + * @return + */ + public static BufferedImage imageRotate(Image src, double angel) { + int src_width = src.getWidth(null); + int src_height = src.getHeight(null); + // calculate the new image size + Rectangle rect_des = CalcRotatedSize(new Rectangle(new Dimension( + src_width, src_height)), angel); + + BufferedImage res = null; + res = new BufferedImage(rect_des.width, rect_des.height, + BufferedImage.TYPE_3BYTE_BGR); + Graphics2D g2 = res.createGraphics(); + // transform + g2.translate((rect_des.width - src_width) / 2, + (rect_des.height - src_height) / 2); + g2.rotate(Math.toRadians(angel), src_width / 2, src_height / 2); + + g2.drawImage(src, null, null); + return res; + } + + public static Rectangle CalcRotatedSize(Rectangle src, double angel) { + // if angel is greater than 90 degree, we need to do some conversion + if (angel >= 90) { + if(angel / 90 % 2 == 1){ + int temp = src.height; + src.height = src.width; + src.width = temp; + } + angel = angel % 90; + } + + double r = Math.sqrt(src.height * src.height + src.width * src.width) / 2; + double len = 2 * Math.sin(Math.toRadians(angel) / 2) * r; + double angel_alpha = (Math.PI - Math.toRadians(angel)) / 2; + double angel_dalta_width = Math.atan((double) src.height / src.width); + double angel_dalta_height = Math.atan((double) src.width / src.height); + + int len_dalta_width = (int) (len * Math.cos(Math.PI - angel_alpha + - angel_dalta_width)); + len_dalta_width=len_dalta_width>0?len_dalta_width:-len_dalta_width; + + int len_dalta_height = (int) (len * Math.cos(Math.PI - angel_alpha + - angel_dalta_height)); + len_dalta_height=len_dalta_height>0?len_dalta_height:-len_dalta_height; + + int des_width = src.width + len_dalta_width * 2; + int des_height = src.height + len_dalta_height * 2; + des_width=des_width>0?des_width:-des_width; + des_height=des_height>0?des_height:-des_height; + return new Rectangle(new Dimension(des_width, des_height)); + } + + + /** + * base64转inputStream + * @param base64string + * @return + */ + public static InputStream BaseToInputStream(String base64string){ + ByteArrayInputStream stream = null; + try { + BASE64Decoder decoder = new BASE64Decoder(); + byte[] bytes1 = decoder.decodeBuffer(base64string); + stream = new ByteArrayInputStream(bytes1); + } catch (Exception e) { + // TODO: handle exception + } + return stream; + } + + /** + * 获取网络图片流 + * + * @param url + * @return + */ + public static InputStream getImageStream(String url) { + try { + HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); + connection.setReadTimeout(5000); + connection.setConnectTimeout(5000); + connection.setRequestMethod("GET"); + if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) { + InputStream inputStream = connection.getInputStream(); + return inputStream; + } + } catch (IOException e) { + System.out.println("获取网络图片出现异常,图片路径为:" + url); + e.printStackTrace(); + } + return null; + } + + + public static String ImageToBase64ByOnline(String imgURL) { + ByteArrayOutputStream data = new ByteArrayOutputStream(); + try { + // 创建URL + URL url = new URL(imgURL); + byte[] by = new byte[1024]; + // 创建链接 + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + conn.setRequestMethod("GET"); + conn.setConnectTimeout(5000); + InputStream is = conn.getInputStream(); + // 将内容读取内存中 + int len = -1; + while ((len = is.read(by)) != -1) { + data.write(by, 0, len); + } + // 关闭流 + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + // 对字节数组Base64编码 + BASE64Encoder encoder = new BASE64Encoder(); + return encoder.encode(data.toByteArray()); + } + + public static String ImageToBase64(String imgPath) { + byte[] data = null; + // 读取图片字节数组 + try { + InputStream in = new FileInputStream(imgPath); + data = new byte[in.available()]; + in.read(data); + in.close(); + } catch (IOException e) { + e.printStackTrace(); + } + // 对字节数组Base64编码 + BASE64Encoder encoder = new BASE64Encoder(); + // 返回Base64编码过的字节数组字符串 + return encoder.encode(Objects.requireNonNull(data)); + } + + public static String QrCodeImg(String imgPath , Integer id) throws Exception { + // 生成二维码 + String qrCodeImg = "qrCode/" + id + ".png"; + String qrCodeUrl = CommonSysConst.getSysConfig().getFileUrl() + qrCodeImg; + QRCodeGenerator.generateQRCodeImage(imgPath + id, 134, 134, qrCodeUrl); + return qrCodeImg; + } +} diff --git a/hai-service/src/main/java/com/hai/common/utils/TelApiUtil.java b/hai-service/src/main/java/com/hai/common/utils/TelApiUtil.java index 9f520447..19ae4a8d 100644 --- a/hai-service/src/main/java/com/hai/common/utils/TelApiUtil.java +++ b/hai-service/src/main/java/com/hai/common/utils/TelApiUtil.java @@ -28,5 +28,8 @@ public class TelApiUtil { return m.matches(); } + public static String phoneDesensitization(String phone) { + return phone.substring(0,3) + "****" + phone.substring(phone.length() - 4); + } } diff --git a/hai-service/src/main/java/com/hai/common/utils/WxUtils.java b/hai-service/src/main/java/com/hai/common/utils/WxUtils.java index 0dd5ae31..7652c17d 100644 --- a/hai-service/src/main/java/com/hai/common/utils/WxUtils.java +++ b/hai-service/src/main/java/com/hai/common/utils/WxUtils.java @@ -484,7 +484,7 @@ public class WxUtils { Arrays.sort(keyArray); StringBuilder sb = new StringBuilder(); for (String k : keyArray) { - if (k.equals(WXPayConstants.FIELD_SIGN)) { + if (k.equals(WXPayConstants.FIELD_SIGN) || k.equals("apiKey")) { continue; } if (data.get(k) != null) // 参数值为空,则不参与签名 diff --git a/hai-service/src/main/java/com/hai/config/CommonConfig.java b/hai-service/src/main/java/com/hai/config/CommonConfig.java new file mode 100644 index 00000000..74fca6f6 --- /dev/null +++ b/hai-service/src/main/java/com/hai/config/CommonConfig.java @@ -0,0 +1,169 @@ +package com.hai.config; + +import org.springframework.context.annotation.Configuration; +import sun.font.FontDesignMetrics; + +import javax.imageio.ImageIO; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Map; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +/** + * @serviceName QrCodeUtilsConfig.java + * @author Sum1Dream + * @version 1.0.0 + * @Description // 工具 + * @createTime 09:54 2022/4/13 + **/ +@Configuration +public class CommonConfig { + + //得到该字体字符串的长度 + public static int getWordWidth(Font font, String content) { + FontDesignMetrics metrics = FontDesignMetrics.getMetrics(font); + int width = 0; + for (int i = 0; i < content.length(); i++) { + width += metrics.charWidth(content.charAt(i)); + } + return width; + } + + // 二维码生产自定义图片 + public static void overlapImage(String path , String content) throws Exception { + BufferedImage read = ImageIO.read(new File(CommonSysConst.getSysConfig().getFileUrl() + "img/original_image.png")); + Image image = ImageIO.read(new File(CommonSysConst.getSysConfig().getFileUrl() + "/" + path)); + + Graphics graphics = read.getGraphics(); + + graphics.drawImage(image, (read.getWidth() - image.getWidth(null))/2 ,306, null); + graphics.setColor(Color.BLACK); + //定义字体 + Font font = new Font("微软雅黑", Font.PLAIN, 14); + //计算该字体文本的长度 + int wordWidth = CommonConfig.getWordWidth(font, content); + + graphics.setFont(font); + graphics.drawString( content, (read.getWidth() - wordWidth)/2 ,304 + image.getHeight(null)); + + ImageIO.write(read , "png" , new File(CommonSysConst.getSysConfig().getFileUrl() + "/" + path)); + } + + + /** + * 多文件压缩成ZIP + * + * @param imageMap 需要压缩的文件列表,键值对为 <文件名,文件的字节数组>,文件名必须包含后缀 + * @param out 压缩文件输出流 + * @throws RuntimeException 压缩失败会抛出运行时异常 + */ + public static void toZip(Map imageMap, OutputStream out) throws RuntimeException { + long start = System.currentTimeMillis(); + try (ZipOutputStream zos = new ZipOutputStream(out)) { + for (Map.Entry map : imageMap.entrySet()) { + zos.putNextEntry(new ZipEntry(map.getKey())); + zos.write(map.getValue()); + zos.closeEntry(); + } + long end = System.currentTimeMillis(); + System.out.println("压缩完成,耗时:" + (end - start) + " ms"); + } catch (Exception e) { + throw new RuntimeException("zip error from ZipUtils", e); + } + } + + + /** + * + * 文件夹压缩成ZIP + * + * @param srcDir 压缩文件夹路径 + * @param out 压缩文件输出流 + * @param keepDirStructure 是否保留原来的目录结构,true:保留目录结构; + * + * false:所有文件跑到压缩包根目录下(注意:不保留目录结构可能会出现同名文件,会压缩失败) + * + * @throws RuntimeException 压缩失败会抛出运行时异常 + * + */ + public static void toZip(String srcDir, OutputStream out, boolean keepDirStructure) + throws RuntimeException { + long start = System.currentTimeMillis(); + ZipOutputStream zos = null; + try { + zos = new ZipOutputStream(out); + File sourceFile = new File(srcDir); + compress(sourceFile, zos, sourceFile.getName(), keepDirStructure); + long end = System.currentTimeMillis(); + System.out.println("压缩完成,耗时:" + (end - start) + " ms"); + } catch (Exception e) { + throw new RuntimeException("zip error from ZipUtils", e); + } finally { + if (zos != null) { + try { + zos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + + /** + * + * 递归压缩方法 + * @param sourceFile 源文件 + * @param zos zip输出流 + * @param name 压缩后的名称 + * @param keepDirStructure 是否保留原来的目录结构,true:保留目录结构; + * + * false:所有文件跑到压缩包根目录下(注意:不保留目录结构可能会出现同名文件,会压缩失败) + * @throws Exception + */ + private static void compress(File sourceFile, ZipOutputStream zos, String name, boolean keepDirStructure) throws Exception { + byte[] buf = new byte[2048]; + if (sourceFile.isFile()) { + // 向zip输出流中添加一个zip实体,构造器中name为zip实体的文件的名字 + zos.putNextEntry(new ZipEntry(name)); + // copy文件到zip输出流中 + int len; + FileInputStream in = new FileInputStream(sourceFile); + while ((len = in.read(buf)) != -1) { + zos.write(buf, 0, len); + } + // Complete the entry + zos.closeEntry(); + in.close(); + } else { + File[] listFiles = sourceFile.listFiles(); + if (listFiles == null || listFiles.length == 0) { + // 需要保留原来的文件结构时,需要对空文件夹进行处理 + if (keepDirStructure) { + // 空文件夹的处理 + zos.putNextEntry(new ZipEntry(name + "/")); + // 没有文件,不需要文件的copy + zos.closeEntry(); + } + } else { + for (File file : listFiles) { + // 判断是否需要保留原来的文件结构 + if (keepDirStructure) { + // 注意:file.getName()前面需要带上父文件夹的名字加一斜杠, + // 不然最后压缩包中就不能保留原来的文件结构,即:所有文件都跑到压缩包根目录下了 + compress(file, zos, name + "/" + file.getName(), keepDirStructure); + } else { + compress(file, zos, file.getName(), keepDirStructure); + } + } + } + } + } + + + +} diff --git a/hai-service/src/main/java/com/hai/config/CommonSysConfig.java b/hai-service/src/main/java/com/hai/config/CommonSysConfig.java index 44cf0163..bc053361 100644 --- a/hai-service/src/main/java/com/hai/config/CommonSysConfig.java +++ b/hai-service/src/main/java/com/hai/config/CommonSysConfig.java @@ -99,6 +99,8 @@ public class CommonSysConfig { private String unionSecret; private String unionRsaKey; + private String fileUrl; + public String getJzAppId() { return jzAppId; } @@ -643,4 +645,12 @@ public class CommonSysConfig { public void setGasDefaultOilStationImg(String gasDefaultOilStationImg) { this.gasDefaultOilStationImg = gasDefaultOilStationImg; } + + public String getFileUrl() { + return fileUrl; + } + + public void setFileUrl(String fileUrl) { + this.fileUrl = fileUrl; + } } diff --git a/hai-service/src/main/java/com/hai/dao/BsDistributionRebateMapperExt.java b/hai-service/src/main/java/com/hai/dao/BsDistributionRebateMapperExt.java index b898b4be..7788ded0 100644 --- a/hai-service/src/main/java/com/hai/dao/BsDistributionRebateMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/BsDistributionRebateMapperExt.java @@ -1,7 +1,29 @@ package com.hai.dao; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.math.BigDecimal; +import java.util.Map; + /** * mapper扩展类 */ public interface BsDistributionRebateMapperExt { -} \ No newline at end of file + + + @Select({ + "" + }) + Map countDistribution(@Param("userId") Long userId); + + @Select({ + "" + }) + BigDecimal toDayIntegralNum(@Param("userId") Long userId); + +} diff --git a/hai-service/src/main/java/com/hai/dao/BsDistributionUserRelMapper.java b/hai-service/src/main/java/com/hai/dao/BsDistributionUserRelMapper.java index f310900b..383963cb 100644 --- a/hai-service/src/main/java/com/hai/dao/BsDistributionUserRelMapper.java +++ b/hai-service/src/main/java/com/hai/dao/BsDistributionUserRelMapper.java @@ -42,15 +42,15 @@ public interface BsDistributionUserRelMapper extends BsDistributionUserRelMapper "insert into bs_distribution_user_rel (agent_id, agent_name, ", "popularize_user_id, popularize_user_name, ", "user_id, user_name, ", - "create_time, update_time, ", - "`status`, ext_1, ext_2, ", - "ext_3)", + "phone, create_time, ", + "update_time, `status`, ", + "ext_1, ext_2, ext_3)", "values (#{agentId,jdbcType=BIGINT}, #{agentName,jdbcType=VARCHAR}, ", "#{popularizeUserId,jdbcType=BIGINT}, #{popularizeUserName,jdbcType=VARCHAR}, ", "#{userId,jdbcType=BIGINT}, #{userName,jdbcType=VARCHAR}, ", - "#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", - "#{status,jdbcType=INTEGER}, #{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, ", - "#{ext3,jdbcType=VARCHAR})" + "#{phone,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ", + "#{updateTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ", + "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(BsDistributionUserRel record); @@ -68,6 +68,7 @@ public interface BsDistributionUserRelMapper extends BsDistributionUserRelMapper @Result(column="popularize_user_name", property="popularizeUserName", jdbcType=JdbcType.VARCHAR), @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), @Result(column="user_name", property="userName", jdbcType=JdbcType.VARCHAR), + @Result(column="phone", property="phone", jdbcType=JdbcType.VARCHAR), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @@ -80,7 +81,7 @@ public interface BsDistributionUserRelMapper extends BsDistributionUserRelMapper @Select({ "select", "id, agent_id, agent_name, popularize_user_id, popularize_user_name, user_id, ", - "user_name, create_time, update_time, `status`, ext_1, ext_2, ext_3", + "user_name, phone, create_time, update_time, `status`, ext_1, ext_2, ext_3", "from bs_distribution_user_rel", "where id = #{id,jdbcType=BIGINT}" }) @@ -92,6 +93,7 @@ public interface BsDistributionUserRelMapper extends BsDistributionUserRelMapper @Result(column="popularize_user_name", property="popularizeUserName", jdbcType=JdbcType.VARCHAR), @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), @Result(column="user_name", property="userName", jdbcType=JdbcType.VARCHAR), + @Result(column="phone", property="phone", jdbcType=JdbcType.VARCHAR), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @@ -118,6 +120,7 @@ public interface BsDistributionUserRelMapper extends BsDistributionUserRelMapper "popularize_user_name = #{popularizeUserName,jdbcType=VARCHAR},", "user_id = #{userId,jdbcType=BIGINT},", "user_name = #{userName,jdbcType=VARCHAR},", + "phone = #{phone,jdbcType=VARCHAR},", "create_time = #{createTime,jdbcType=TIMESTAMP},", "update_time = #{updateTime,jdbcType=TIMESTAMP},", "`status` = #{status,jdbcType=INTEGER},", diff --git a/hai-service/src/main/java/com/hai/dao/BsDistributionUserRelMapperExt.java b/hai-service/src/main/java/com/hai/dao/BsDistributionUserRelMapperExt.java index 1cc0bed1..f1f527e7 100644 --- a/hai-service/src/main/java/com/hai/dao/BsDistributionUserRelMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/BsDistributionUserRelMapperExt.java @@ -1,7 +1,42 @@ package com.hai.dao; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; +import java.util.Map; + /** * mapper扩展类 */ public interface BsDistributionUserRelMapperExt { -} \ No newline at end of file + + + @Select({ + "" + }) + List> getDistributionAgent(); + + @Select({ + "" + }) + List> getDistributionFirst(@Param("agentId") Long agentId); + + @Select({ + "" + }) + List> getDistributionSecond(@Param("agentId") Long agentId , @Param("popularizeUserId") Long popularizeUserId); + +} diff --git a/hai-service/src/main/java/com/hai/dao/BsDistributionUserRelSqlProvider.java b/hai-service/src/main/java/com/hai/dao/BsDistributionUserRelSqlProvider.java index 57f2186e..4a72218b 100644 --- a/hai-service/src/main/java/com/hai/dao/BsDistributionUserRelSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/BsDistributionUserRelSqlProvider.java @@ -52,6 +52,10 @@ public class BsDistributionUserRelSqlProvider { sql.VALUES("user_name", "#{userName,jdbcType=VARCHAR}"); } + if (record.getPhone() != null) { + sql.VALUES("phone", "#{phone,jdbcType=VARCHAR}"); + } + if (record.getCreateTime() != null) { sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); } @@ -92,6 +96,7 @@ public class BsDistributionUserRelSqlProvider { sql.SELECT("popularize_user_name"); sql.SELECT("user_id"); sql.SELECT("user_name"); + sql.SELECT("phone"); sql.SELECT("create_time"); sql.SELECT("update_time"); sql.SELECT("`status`"); @@ -143,6 +148,10 @@ public class BsDistributionUserRelSqlProvider { sql.SET("user_name = #{record.userName,jdbcType=VARCHAR}"); } + if (record.getPhone() != null) { + sql.SET("phone = #{record.phone,jdbcType=VARCHAR}"); + } + if (record.getCreateTime() != null) { sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); } @@ -182,6 +191,7 @@ public class BsDistributionUserRelSqlProvider { sql.SET("popularize_user_name = #{record.popularizeUserName,jdbcType=VARCHAR}"); sql.SET("user_id = #{record.userId,jdbcType=BIGINT}"); sql.SET("user_name = #{record.userName,jdbcType=VARCHAR}"); + sql.SET("phone = #{record.phone,jdbcType=VARCHAR}"); sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); @@ -222,6 +232,10 @@ public class BsDistributionUserRelSqlProvider { sql.SET("user_name = #{userName,jdbcType=VARCHAR}"); } + if (record.getPhone() != null) { + sql.SET("phone = #{phone,jdbcType=VARCHAR}"); + } + if (record.getCreateTime() != null) { sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); } diff --git a/hai-service/src/main/java/com/hai/dao/BsRequestRecordMapperExt.java b/hai-service/src/main/java/com/hai/dao/BsRequestRecordMapperExt.java index 70c4a8b3..c32a6564 100644 --- a/hai-service/src/main/java/com/hai/dao/BsRequestRecordMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/BsRequestRecordMapperExt.java @@ -1,7 +1,14 @@ package com.hai.dao; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.Map; + /** * mapper扩展类 */ public interface BsRequestRecordMapperExt { -} \ No newline at end of file + + +} diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java b/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java index 15f27d63..d86bdc37 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java @@ -264,4 +264,4 @@ public interface HighOrderMapper extends HighOrderMapperExt { "where id = #{id,jdbcType=BIGINT}" }) int updateByPrimaryKey(HighOrder record); -} \ No newline at end of file +} diff --git a/hai-service/src/main/java/com/hai/entity/BsDistributionUserRel.java b/hai-service/src/main/java/com/hai/entity/BsDistributionUserRel.java index 75f33668..11197afe 100644 --- a/hai-service/src/main/java/com/hai/entity/BsDistributionUserRel.java +++ b/hai-service/src/main/java/com/hai/entity/BsDistributionUserRel.java @@ -48,6 +48,11 @@ public class BsDistributionUserRel implements Serializable { */ private String userName; + /** + * 用户手机号码 + */ + private String phone; + /** * 创建时间 */ @@ -136,6 +141,14 @@ public class BsDistributionUserRel implements Serializable { this.userName = userName; } + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + public Date getCreateTime() { return createTime; } @@ -203,6 +216,7 @@ public class BsDistributionUserRel implements Serializable { && (this.getPopularizeUserName() == null ? other.getPopularizeUserName() == null : this.getPopularizeUserName().equals(other.getPopularizeUserName())) && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId())) && (this.getUserName() == null ? other.getUserName() == null : this.getUserName().equals(other.getUserName())) + && (this.getPhone() == null ? other.getPhone() == null : this.getPhone().equals(other.getPhone())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) @@ -222,6 +236,7 @@ public class BsDistributionUserRel implements Serializable { result = prime * result + ((getPopularizeUserName() == null) ? 0 : getPopularizeUserName().hashCode()); result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode()); result = prime * result + ((getUserName() == null) ? 0 : getUserName().hashCode()); + result = prime * result + ((getPhone() == null) ? 0 : getPhone().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); @@ -244,6 +259,7 @@ public class BsDistributionUserRel implements Serializable { sb.append(", popularizeUserName=").append(popularizeUserName); sb.append(", userId=").append(userId); sb.append(", userName=").append(userName); + sb.append(", phone=").append(phone); sb.append(", createTime=").append(createTime); sb.append(", updateTime=").append(updateTime); sb.append(", status=").append(status); @@ -254,4 +270,4 @@ public class BsDistributionUserRel implements Serializable { sb.append("]"); return sb.toString(); } -} \ No newline at end of file +} diff --git a/hai-service/src/main/java/com/hai/entity/BsDistributionUserRelExample.java b/hai-service/src/main/java/com/hai/entity/BsDistributionUserRelExample.java index 2f4a006e..b08c7c15 100644 --- a/hai-service/src/main/java/com/hai/entity/BsDistributionUserRelExample.java +++ b/hai-service/src/main/java/com/hai/entity/BsDistributionUserRelExample.java @@ -575,6 +575,76 @@ public class BsDistributionUserRelExample { return (Criteria) this; } + public Criteria andPhoneIsNull() { + addCriterion("phone is null"); + return (Criteria) this; + } + + public Criteria andPhoneIsNotNull() { + addCriterion("phone is not null"); + return (Criteria) this; + } + + public Criteria andPhoneEqualTo(String value) { + addCriterion("phone =", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneNotEqualTo(String value) { + addCriterion("phone <>", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneGreaterThan(String value) { + addCriterion("phone >", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneGreaterThanOrEqualTo(String value) { + addCriterion("phone >=", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneLessThan(String value) { + addCriterion("phone <", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneLessThanOrEqualTo(String value) { + addCriterion("phone <=", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneLike(String value) { + addCriterion("phone like", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneNotLike(String value) { + addCriterion("phone not like", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneIn(List values) { + addCriterion("phone in", values, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneNotIn(List values) { + addCriterion("phone not in", values, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneBetween(String value1, String value2) { + addCriterion("phone between", value1, value2, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneNotBetween(String value1, String value2) { + addCriterion("phone not between", value1, value2, "phone"); + return (Criteria) this; + } + public Criteria andCreateTimeIsNull() { addCriterion("create_time is null"); return (Criteria) this; diff --git a/hai-service/src/main/java/com/hai/entity/HighOrder.java b/hai-service/src/main/java/com/hai/entity/HighOrder.java index ee53040b..9be617a3 100644 --- a/hai-service/src/main/java/com/hai/entity/HighOrder.java +++ b/hai-service/src/main/java/com/hai/entity/HighOrder.java @@ -246,6 +246,36 @@ public class HighOrder implements Serializable { private String password; + private String time; + + private String goodsTypeName; + + private String agentName; + + public String getAgentName() { + return agentName; + } + + public void setAgentName(String agentName) { + this.agentName = agentName; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public String getGoodsTypeName() { + return goodsTypeName; + } + + public void setGoodsTypeName(String goodsTypeName) { + this.goodsTypeName = goodsTypeName; + } + /** * 是否自动充值积分 0 否 1 是 */ diff --git a/hai-service/src/main/java/com/hai/enum_type/GoodsType.java b/hai-service/src/main/java/com/hai/enum_type/GoodsType.java index 4f246b7d..9cdfe5d3 100644 --- a/hai-service/src/main/java/com/hai/enum_type/GoodsType.java +++ b/hai-service/src/main/java/com/hai/enum_type/GoodsType.java @@ -9,7 +9,11 @@ public enum GoodsType { goodsType3(3 , "团油"), goodsType4(4 , "KFC"), goodsType5(5 , "电影票"), - goodsType6(6 , "话费充值") + goodsType6(6 , "话费充值"), + goodsType7(7 , "优惠卷包"), + goodsType8(8 , "汇联通充值"), + goodsType9(9 , "星巴克"), + goodsType10(10 , "会员充值"), ; private Integer type; diff --git a/hai-service/src/main/java/com/hai/enum_type/OrderLogoEnum.java b/hai-service/src/main/java/com/hai/enum_type/OrderLogoEnum.java new file mode 100644 index 00000000..35f6e150 --- /dev/null +++ b/hai-service/src/main/java/com/hai/enum_type/OrderLogoEnum.java @@ -0,0 +1,49 @@ +package com.hai.enum_type; + +import java.util.Objects; + +/** + * 产品图片 + * @author hurui + */ +public enum OrderLogoEnum { + name1("orderLogo/coupon.png", 1), + name3("orderLogo/refuel.png", 3), + name4("orderLogo/kfc.png", 4), + name9("orderLogo/starbucks.png", 9), + name10("orderLogo/member-recharge.png", 10), + name20("orderLogo/call-charges.png", 20), + ; + + + private String imgUrl; + + private Integer type; + public static String getNameByImgUrl(Integer type) { + for (OrderLogoEnum ele : values()) { + if(Objects.equals(type,ele.getType())) return ele.getImgUrl(); + } + return null; + } + + OrderLogoEnum(String imgUrl, Integer type) { + this.imgUrl = imgUrl; + this.type = type; + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public String getImgUrl() { + return imgUrl; + } + + public void setImgUrl(String imgUrl) { + this.imgUrl = imgUrl; + } +} diff --git a/hai-service/src/main/java/com/hai/service/BsDistributionUserRelService.java b/hai-service/src/main/java/com/hai/service/BsDistributionUserRelService.java index bae156b7..f5b12cd5 100644 --- a/hai-service/src/main/java/com/hai/service/BsDistributionUserRelService.java +++ b/hai-service/src/main/java/com/hai/service/BsDistributionUserRelService.java @@ -1,7 +1,9 @@ package com.hai.service; +import com.alibaba.fastjson.JSONObject; import com.hai.entity.BsDistributionRebate; import com.hai.entity.BsDistributionUserRel; +import com.hai.entity.HighUser; import java.util.List; import java.util.Map; @@ -23,7 +25,7 @@ public interface BsDistributionUserRelService { * @Param [java.lang.Long, java.lang.Long] * @return void */ - void insertDistributionRebate(Long userId , String userName, Long popularizeUserId); + void insertDistributionRebate(Long userId , Long popularizeUserId , String regionId); /** * @Author Sum1Dream @@ -44,4 +46,86 @@ public interface BsDistributionUserRelService { * @return com.hai.entity.BsDistributionUserRel */ BsDistributionUserRel findDistributionUserRel(Map map); + + /** + * @Author Sum1Dream + * @name distributionRebate.java + * @Description // 分销返利 + * @Date 14:24 2022/8/15 + * @Param [com.alibaba.fastjson.JSONObject] + * @return void + */ + void distributionRebate(JSONObject object); + + /** + * @Author Sum1Dream + * @name userDistributionStatistics.java + * @Description // 用户分销统计 + * @Date 10:50 2022/8/16 + * @Param [java.lang.Long] + * @return com.alibaba.fastjson.JSONObject + */ + JSONObject userDistributionStatistics(Long userId); + + + /** + * @Author Sum1Dream + * @name getDistributionRebateList.java + * @Description //TODO + * @Date 15:52 2022/8/18 + * @Param [java.util.Map] + * @return java.util.List + */ + List getDistributionRebateList(Map map) throws Exception; + + /** + * @Author Sum1Dream + * @name getDistributionAgent.java + * @Description // 查询分销代理商 + * @Date 16:11 2022/8/18 + * @Param [] + * @return java.util.List> + */ + List> getDistributionAgent(); + + /** + * @Author Sum1Dream + * @name getDistributionFirst.java + * @Description // 查询一级分销 + * @Date 16:27 2022/8/18 + * @Param [] + * @return java.util.List> + */ + List> getDistributionFirst(Long agentId); + + /** + * @Author Sum1Dream + * @name getDistributionSecond.java + * @Description // 查询二级分销 + * @Date 16:27 2022/8/18 + * @Param [] + * @return java.util.List> + */ + List> getDistributionSecond(Long agentId , Long popularizeUserId); + + /** + * @Author Sum1Dream + * @name getDistributionIntegralList.java + * @Description // 查询分销积分列表 + * @Date 17:10 2022/8/18 + * @Param [java.util.Map] + * @return java.util.List + */ + List getDistributionIntegralList(Map map); + + /** + * @Author Sum1Dream + * @name agentUserList.java + * @Description // 查询代理商用户 + * @Date 15:21 2022/8/19 + * @Param [] + * @return java.util.List + */ + List agentUserList(); + } diff --git a/hai-service/src/main/java/com/hai/service/HighOrderService.java b/hai-service/src/main/java/com/hai/service/HighOrderService.java index 1512a62e..69b18dca 100644 --- a/hai-service/src/main/java/com/hai/service/HighOrderService.java +++ b/hai-service/src/main/java/com/hai/service/HighOrderService.java @@ -562,4 +562,25 @@ public interface HighOrderService { * @return com.alibaba.fastjson.JSONObject */ JSONObject orderSource(Integer goodsType , Long goodsId , String orderNo , Long companyId); + + /** + * @Author Sum1Dream + * @name promoteOrderList.java + * @Description // 根据渠道商编码查询订单 + * @Date 16:10 2022/8/19 + * @Param [java.lang.Long] + * @return java.util.List + */ + List promoteOrderList(Long identificationCode) throws Exception; + + /** + * @Author Sum1Dream + * @name orderListByAgentId.java + * @Description // B端查询代理商订单 + * @Date 16:11 2022/8/19 + * @Param [java.util.Map] + * @return java.util.List + */ + List orderListByAgentId(Map map) throws Exception; } + diff --git a/hai-service/src/main/java/com/hai/service/HighUserService.java b/hai-service/src/main/java/com/hai/service/HighUserService.java index 14928723..4f1d896b 100644 --- a/hai-service/src/main/java/com/hai/service/HighUserService.java +++ b/hai-service/src/main/java/com/hai/service/HighUserService.java @@ -1,5 +1,6 @@ package com.hai.service; +import com.alibaba.fastjson.JSONObject; import com.hai.entity.HighUser; import javax.servlet.http.HttpServletRequest; @@ -99,7 +100,7 @@ public interface HighUserService { * @param: [highUser] 用户信息 * @return: com.hai.entity.HighUser */ - void insertUser(HighUser highUser); + void insertUser(HighUser highUser , Long popularizeUserId , String regionId); /** * @Author 胡锐 @@ -121,4 +122,15 @@ public interface HighUserService { Long countUser(); + /** + * @Author Sum1Dream + * @name userDistributionStatistics.java + * @Description // 用户分销统计 + * @Date 10:00 2022/8/16 + * @Param [java.lang.Long] + * @return com.alibaba.fastjson.JSONObject + */ + JSONObject userDistributionStatistics(Long userId); + + } diff --git a/hai-service/src/main/java/com/hai/service/impl/BsDistributionUserRelServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/BsDistributionUserRelServiceImpl.java index bccc9d63..09fa920b 100644 --- a/hai-service/src/main/java/com/hai/service/impl/BsDistributionUserRelServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/BsDistributionUserRelServiceImpl.java @@ -1,12 +1,15 @@ package com.hai.service.impl; +import com.alibaba.fastjson.JSONObject; +import com.hai.common.utils.DateUtil; +import com.hai.common.utils.TelApiUtil; import com.hai.dao.BsDistributionRebateMapper; import com.hai.dao.BsDistributionUserRelMapper; -import com.hai.entity.BsDistributionRebate; -import com.hai.entity.BsDistributionUserRel; -import com.hai.entity.BsDistributionUserRelExample; -import com.hai.service.BsDistributionUserRelService; +import com.hai.dao.HighUserMapper; +import com.hai.entity.*; +import com.hai.service.*; import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -21,8 +24,29 @@ public class BsDistributionUserRelServiceImpl implements BsDistributionUserRelSe @Resource private BsDistributionUserRelMapper bsDistributionUserRelMapper; + @Resource + private HighDiscountPackageService highDiscountPackageService; + + @Resource + private BsDistributionRebateMapper bsDistributionRebateMapper; + + @Resource + private HighUserService highUserService; + + @Resource + private BsCompanyService bsCompanyService; + + @Resource + private CommonService commonService; + + @Resource + private HighUserMapper highUserMapper; + @Override - public void insertDistributionRebate(Long userId, String userName , Long popularizeUserId) { + public void insertDistributionRebate(Long userId, Long popularizeUserId , String regionId) { + + HighUser user = highUserService.findByUserId(userId); + HighUser pUser = highUserService.findByUserId(popularizeUserId); // 定义分销关联关系 BsDistributionUserRel distributionUserRel = new BsDistributionUserRel(); @@ -32,24 +56,78 @@ public class BsDistributionUserRelServiceImpl implements BsDistributionUserRelSe map.put("userId" , popularizeUserId); BsDistributionUserRel popularizeUser = findDistributionUserRel(map); + if (pUser != null) { + if (pUser.getIsAgent() != null) { + distributionUserRel.setAgentId(pUser.getId()); + distributionUserRel.setAgentName(pUser.getName()); + } else { + if (popularizeUser != null) { + distributionUserRel.setAgentId(popularizeUser.getAgentId()); + distributionUserRel.setAgentName(popularizeUser.getAgentName()); + } + distributionUserRel.setPopularizeUserId(popularizeUserId); + distributionUserRel.setPopularizeUserName(pUser.getName()); + } + + distributionUserRel.setUserId(userId); + distributionUserRel.setUserName(user.getName()); + distributionUserRel.setPhone(TelApiUtil.phoneDesensitization(user.getPhone())); + distributionUserRel.setCreateTime(new Date()); + distributionUserRel.setUpdateTime(new Date()); + distributionUserRel.setStatus(100); + + bsDistributionUserRelMapper.insert(distributionUserRel); + + new Thread(() -> { + + try { + + SecRegion region = commonService.getParentByRegion(Long.valueOf(regionId)); + BsCompany bsCompany = bsCompanyService.selectCompanyByRegion(region.getRegionId().toString()); - distributionUserRel.setUserId(userId); - distributionUserRel.setUserName(userName); - distributionUserRel.setAgentId(popularizeUser.getAgentId()); - distributionUserRel.setAgentName(popularizeUser.getAgentName()); - distributionUserRel.setPopularizeUserId(popularizeUserId); - distributionUserRel.setPopularizeUserName(popularizeUser.getUserName()); - distributionUserRel.setCreateTime(new Date()); - distributionUserRel.setUpdateTime(new Date()); - distributionUserRel.setStatus(100); + // 查询注册有礼优惠券包 + HighDiscountPackage discountPackage = highDiscountPackageService.getCallExclusive(3 , bsCompany.getId().intValue()); + Map freeMap = new HashMap<>(); + freeMap.put("discountPackageId", discountPackage.getId()); + freeMap.put("userId", userId); + freeMap.put("userPhone", user.getPhone()); + highDiscountPackageService.freeUserDiscountPackage(freeMap); - bsDistributionUserRelMapper.insert(distributionUserRel); + if (pUser.getIsAgent() == null) { + // 查询推广有礼优惠券包 + HighDiscountPackage promoteDiscountPackage = highDiscountPackageService.getCallExclusive(4 , bsCompany.getId().intValue()); + Map freeMap1 = new HashMap<>(); + freeMap1.put("discountPackageId", promoteDiscountPackage.getId()); + freeMap1.put("userId", pUser.getId()); + freeMap1.put("userPhone", pUser.getPhone()); + highDiscountPackageService.freeUserDiscountPackage(freeMap1); + } + + } catch (Exception e) { + e.printStackTrace(); + } + + }).start(); + } } @Override public List getDistributionUserRelList(Map map) { - return null; + + BsDistributionUserRelExample example = new BsDistributionUserRelExample(); + BsDistributionUserRelExample.Criteria criteria = example.createCriteria(); + + + if (MapUtils.getLong(map , "userId") != null) { + criteria.andUserIdEqualTo(MapUtils.getLong(map , "userId")); + } + + if (MapUtils.getLong(map , "popularizeUserId") != null) { + criteria.andPopularizeUserIdEqualTo(MapUtils.getLong(map , "popularizeUserId")); + } + + return bsDistributionUserRelMapper.selectByExample(example); } @Override @@ -70,4 +148,160 @@ public class BsDistributionUserRelServiceImpl implements BsDistributionUserRelSe return null; } + + + @Override + public void distributionRebate(JSONObject object) { + HighUser user = highUserService.findByUserId(object.getLong("userId")); + // 查询下单用户上级推广员 + Map mapSuper = new HashMap<>(); + mapSuper.put("userId" , object.getLong("userId")); + BsDistributionUserRel distributionUserRel = findDistributionUserRel(mapSuper); + BsDistributionRebate distributionRebate = new BsDistributionRebate(); + // 上级推广员返利 + if (distributionUserRel != null) { + distributionRebate.setAgentId(distributionUserRel.getAgentId()); + distributionRebate.setCreateTime(new Date()); + distributionRebate.setUpdateTime(new Date()); + distributionRebate.setStatus(100); + distributionRebate.setType(1); + distributionRebate.setUserName(user.getName()); + distributionRebate.setUserId(object.getLong("userId")); + distributionRebate.setAgentId(distributionUserRel.getAgentId()); + distributionUserRel.setAgentName(distributionUserRel.getAgentName()); + distributionUserRel.setUserName(user.getName()); + distributionRebate.setPopularizeUserId(distributionUserRel.getPopularizeUserId()); + distributionRebate.setTitle(object.getString("title")); + distributionRebate.setIntegralNum(object.getBigDecimal("integralNumFirst")); + distributionRebate.setOrderNo(object.getString("orderNo")); + distributionRebate.setExt1(object.getString("logoImg")); + + if (distributionUserRel.getPopularizeUserId() != null) { + bsDistributionRebateMapper.insert(distributionRebate); + // 上级返利 + highUserService.goldHandle(distributionUserRel.getPopularizeUserId(), object.getInteger("integralNumFirst"), 1, 4, object.getLong("userId") , user.getName() + "下单:获得返利" + object.getInteger("integralNumFirst")); + + // 查询下单用户顶级推广员 + Map mapTop = new HashMap<>(); + mapTop.put("userId" , distributionUserRel.getPopularizeUserId()); + BsDistributionUserRel distributionUserRelTop = findDistributionUserRel(mapTop); + if (distributionUserRelTop != null) { + // 顶级推广员 + if (distributionUserRelTop.getPopularizeUserId() != null) { + distributionRebate.setIntegralNum(object.getBigDecimal("integralNumSecond")); + distributionRebate.setPopularizeUserId(distributionUserRelTop.getPopularizeUserId()); + distributionRebate.setType(2); + bsDistributionRebateMapper.insert(distributionRebate); + // 顶级返利 + highUserService.goldHandle(distributionUserRelTop.getPopularizeUserId(), object.getInteger("integralNumSecond"), 1, 4, object.getLong("userId") , user.getName() + "下单:获得返利" + object.getInteger("integralNumSecond")); + + } + + } + } + + } + + } + + @Override + public JSONObject userDistributionStatistics(Long userId) { + + JSONObject jsonObject = new JSONObject(); + + BsDistributionUserRelExample example = new BsDistributionUserRelExample(); + BsDistributionUserRelExample.Criteria criteria = example.createCriteria(); + criteria.andPopularizeUserIdEqualTo(userId); + + Map map = bsDistributionRebateMapper.countDistribution(userId); + + jsonObject.put("inviteeNum" , bsDistributionUserRelMapper.countByExample(example)); + jsonObject.put("integralIncome" , map.get("sum")); + jsonObject.put("orderCount" , map.get("count")); + jsonObject.put("toDayIntegralNum" , bsDistributionRebateMapper.toDayIntegralNum(userId)); + + + return jsonObject; + } + + @Override + public List getDistributionRebateList(Map map) throws Exception { + BsDistributionRebateExample example = new BsDistributionRebateExample(); + BsDistributionRebateExample.Criteria criteria = example.createCriteria(); + + + if (MapUtils.getLong(map , "userId") != null) { + criteria.andUserIdEqualTo(MapUtils.getLong(map , "userId")); + } + + if (MapUtils.getLong(map , "popularizeUserId") != null) { + criteria.andPopularizeUserIdEqualTo(MapUtils.getLong(map , "popularizeUserId")); + } + + List list = bsDistributionRebateMapper.selectByExample(example); + + for (BsDistributionRebate distributionRebate : list ) { + distributionRebate.setExt3(DateUtil.date2String(distributionRebate.getCreateTime() , "MM月dd日 HH:mm")); + } + + return list; + } + + @Override + public List> getDistributionAgent() { + return bsDistributionUserRelMapper.getDistributionAgent(); + } + + @Override + public List> getDistributionFirst(Long agentId) { + return bsDistributionUserRelMapper.getDistributionFirst(agentId); + } + + @Override + public List> getDistributionSecond(Long agentId, Long popularizeUserId) { + return bsDistributionUserRelMapper.getDistributionSecond(agentId , popularizeUserId); + } + + @Override + public List getDistributionIntegralList(Map map) { + + BsDistributionRebateExample example = new BsDistributionRebateExample(); + BsDistributionRebateExample.Criteria criteria = example.createCriteria(); + + if (MapUtils.getString(map, "title") != null) { + criteria.andTitleLike("%" + MapUtils.getString(map, "title") + "%"); + } + if (MapUtils.getInteger(map, "type") != null) { + criteria.andTypeEqualTo(MapUtils.getInteger(map, "type")); + } + if (MapUtils.getString(map, "orderNo") != null) { + criteria.andOrderNoEqualTo(MapUtils.getString(map, "orderNo")); + } + if (MapUtils.getLong(map, "agentId") != null) { + criteria.andAgentIdEqualTo(MapUtils.getLong(map, "agentId")); + } + if (MapUtils.getLong(map, "popularizeUserId") != null) { + criteria.andPopularizeUserIdEqualTo(MapUtils.getLong(map, "popularizeUserId")); + } + if (MapUtils.getString(map, "userName") != null) { + criteria.andUserNameLike("%" + MapUtils.getString(map, "userName") + "%"); + } + if (StringUtils.isNotBlank(MapUtils.getString(map, "createTimeS")) && StringUtils.isNotBlank(MapUtils.getString(map, "createTimeE"))) { + criteria.andCreateTimeBetween( + DateUtil.format(MapUtils.getString(map, "createTimeS"), "yyyy-MM-dd HH:mm:ss"), + DateUtil.format(MapUtils.getString(map, "createTimeE"), "yyyy-MM-dd HH:mm:ss")); + } + + example.setOrderByClause("create_time desc"); + return bsDistributionRebateMapper.selectByExample(example); + } + + @Override + public List agentUserList() { + + HighUserExample example = new HighUserExample(); + example.createCriteria().andIsAgentEqualTo(true).andStatusEqualTo(1); + + return highUserMapper.selectByExample(example); + } } diff --git a/hai-service/src/main/java/com/hai/service/impl/BsIntegralRebateServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/BsIntegralRebateServiceImpl.java index 17c39c9a..a3eef794 100644 --- a/hai-service/src/main/java/com/hai/service/impl/BsIntegralRebateServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/BsIntegralRebateServiceImpl.java @@ -6,6 +6,7 @@ import com.hai.dao.BsIntegralRebateMapper; import com.hai.entity.BsIntegralRebate; import com.hai.entity.BsIntegralRebateExample; import com.hai.entity.HighOrder; +import com.hai.service.BsDistributionUserRelService; import com.hai.service.BsIntegralRebateService; import com.hai.service.HighOrderService; import com.hai.service.HighUserService; @@ -30,6 +31,9 @@ public class BsIntegralRebateServiceImpl implements BsIntegralRebateService { @Resource private HighOrderService highOrderService; + @Resource + private BsDistributionUserRelService bsDistributionUserRelService; + @Override public BsIntegralRebate findIntegralRebateByMap(Map map) { @@ -111,13 +115,25 @@ public class BsIntegralRebateServiceImpl implements BsIntegralRebateService { order.setWhetherRebate(true); BigDecimal integralNum = object.getBigDecimal("price").multiply(bsIntegralRebate.getPercentage()).setScale( 0, BigDecimal.ROUND_HALF_UP ); + BigDecimal integralNumFirst = object.getBigDecimal("price").multiply(bsIntegralRebate.getFirstDistribution()).setScale( 0, BigDecimal.ROUND_HALF_UP ); + BigDecimal integralNumSecond = object.getBigDecimal("price").multiply(bsIntegralRebate.getSecondDistribution()).setScale( 0, BigDecimal.ROUND_HALF_UP ); -/* - HighOrder order = highOrderService.getOrderById(object.getLong("orderId")); -*/ + order.setWhetherRebate(true); + JSONObject jsonObject = new JSONObject(); + + jsonObject.put("integralNumFirst" , integralNumFirst); + jsonObject.put("integralNumSecond" , integralNumSecond); + jsonObject.put("title" , object.getString("name")); + jsonObject.put("orderNo" , order.getOrderNo()); + jsonObject.put("userId" , object.getLong("userId")); + jsonObject.put("logoImg" , object.getString("logoImg")); + + bsDistributionUserRelService.distributionRebate(jsonObject); + highOrderService.updateOrder(order); highUserService.goldHandle(object.getLong("userId"), integralNum.intValue(), 1, 4, object.getLong("orderId") , object.getString("remark") + integralNum); + } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageServiceImpl.java index a0ce3fdd..b8e714dc 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageServiceImpl.java @@ -402,7 +402,7 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic user.setGold(0); user.setStatus(1); user.setInfoCompleteStatus(1); // 用户信息完整状态 0:完整 1:需要填写用户信息 2:需要填写手机号 - highUserService.insertUser(user); + highUserService.insertUser(user , null , null); // 赠送卷包 Map freeMap = new HashMap<>(); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index 5df36e92..629d68be 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -1608,6 +1608,11 @@ public class HighOrderServiceImpl implements HighOrderService { if (MapUtils.getString(map, "merchId") != null) { criteria.andMerchIdEqualTo(MapUtils.getString(map, "merchId")); } + + if (MapUtils.getLong(map, "identificationCode") != null) { + criteria.andIdentificationCodeEqualTo(MapUtils.getLong(map, "identificationCode")); + } + if (StringUtils.isNotBlank(MapUtils.getString(map, "createTimeS")) && StringUtils.isNotBlank(MapUtils.getString(map, "createTimeE"))) { criteria.andCreateTimeBetween( DateUtil.format(MapUtils.getString(map, "createTimeS"), "yyyy-MM-dd HH:mm:ss"), @@ -3008,9 +3013,10 @@ public class HighOrderServiceImpl implements HighOrderService { HighCoupon coupon = highCouponService.getCouponById(goodsId); object.put("type" , 1); - object.put("productId", coupon.getCouponSource()); + object.put("productId", 1); object.put("companyId", coupon.getCompanyId()); - object.put("remark" , "卡券订单" + orderNo + "积分返利:"); + object.put("remark" , "卡券订单:"+ coupon.getCouponName() + "-" + orderNo + "积分返利:"); + object.put("name" , "购买卡券产品:"+ coupon.getCouponName()); } if (goodsType == 3) { @@ -3019,6 +3025,7 @@ public class HighOrderServiceImpl implements HighOrderService { object.put("productId", 1); object.put("companyId", merchantStore.getCompanyId()); object.put("remark" , "在线加油订单" + orderNo + "积分返利:"); + object.put("name" , "购买在线加油产品"); } if (goodsType == 4) { @@ -3026,20 +3033,70 @@ public class HighOrderServiceImpl implements HighOrderService { object.put("productId", 2); object.put("companyId", companyId); object.put("remark" , "肯德基订单" + orderNo + "积分返利:"); + object.put("name" , "购买肯德基产品"); } if (goodsType == 9) { object.put("type" , 4); object.put("productId", 1); object.put("companyId", companyId); object.put("remark" , "星巴克订单" + orderNo + "积分返利:"); + object.put("name" , "购买星巴克产品"); } if (goodsType == 10) { object.put("type" , 4); object.put("productId", 3); object.put("companyId", companyId); object.put("remark" , "会员充值订单" + orderNo + "积分返利:"); + object.put("name" , "购买会员充值产品"); } + object.put("logoImg" , OrderLogoEnum.getNameByImgUrl(goodsType)); return object; } + + @Override + public List promoteOrderList(Long identificationCode) throws Exception { + + HighOrderExample example = new HighOrderExample(); + HighOrderExample.Criteria criteria = example.createCriteria(); + + criteria.andIdentificationCodeEqualTo(identificationCode).andOrderStatusEqualTo(3); + + List list = highOrderMapper.selectByExample(example); + + for (HighOrder order : list) { + order.setTime(DateUtil.date2String(order.getCreateTime() , "MM月dd日 HH:mm")); + List childOrder = getChildOrderByOrder(order.getId()); + order.setGoodsTypeName("购买:" + GoodsType.getNameByType(childOrder.get(0).getGoodsType())); + } + + return list; + } + + @Override + public List orderListByAgentId(Map map) throws Exception { + + HighOrderExample example = new HighOrderExample(); + HighOrderExample.Criteria criteria = example.createCriteria(); + + criteria.andOrderStatusEqualTo(3); + + if (MapUtils.getLong(map , "agentId") != null) { + criteria.andIdentificationCodeEqualTo(MapUtils.getLong(map , "agentId")); + } else { + criteria.andIdentificationCodeIsNotNull(); + } + + List list = highOrderMapper.selectByExample(example); + + for (HighOrder order : list) { + HighUser user = highUserService.findByUserId(order.getIdentificationCode()); + order.setTime(DateUtil.date2String(order.getCreateTime() , "MM月dd日 HH:mm")); + List childOrder = getChildOrderByOrder(order.getId()); + order.setGoodsTypeName("购买:" + GoodsType.getNameByType(childOrder.get(0).getGoodsType())); + order.setAgentName(user.getName()); + } + + return list; + } } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java index fb45eb09..d3d2814e 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java @@ -1,5 +1,6 @@ package com.hai.service.impl; +import com.alibaba.fastjson.JSONObject; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; @@ -61,6 +62,9 @@ public class HighUserServiceImpl implements HighUserService { @Resource private HighOilCardService oilCardService; + @Resource + private BsDistributionUserRelService distributionUserRelService; + @Override public List getListUser(Map map) { HighUserExample example = new HighUserExample(); @@ -212,7 +216,7 @@ public class HighUserServiceImpl implements HighUserService { @Override @Transactional(propagation= Propagation.REQUIRES_NEW) - public void insertUser(HighUser highUser) { + public void insertUser(HighUser highUser , Long popularizeUserId , String regionId) { highUserMapper.insert(highUser); if (highUser.getPhone() != null) { @@ -221,6 +225,9 @@ public class HighUserServiceImpl implements HighUserService { highUserCardService.bindCard(UserCardType.type2.getType(), oilCard.getCardNo(), highUser.getId()); } } + + // 绑定推广关联关系 + distributionUserRelService.insertDistributionRebate(highUser.getId() , popularizeUserId , regionId); } @Override @@ -274,4 +281,13 @@ public class HighUserServiceImpl implements HighUserService { example.createCriteria().andResIdEqualTo(resId).andResTypeEqualTo(resType); return highGoldRecMapper.selectByExample(example).size() == 0; } + + @Override + public JSONObject userDistributionStatistics(Long userId) { + + JSONObject object = new JSONObject(); + + + return null; + } } diff --git a/hai-service/src/main/resources/dev/commonConfig.properties b/hai-service/src/main/resources/dev/commonConfig.properties index 21340389..e9cef055 100644 --- a/hai-service/src/main/resources/dev/commonConfig.properties +++ b/hai-service/src/main/resources/dev/commonConfig.properties @@ -96,3 +96,8 @@ CyPostUrl=http://120.24.83.85:8999/ unionAppId=7113783e75354df2a985efd3f31b9528 unionSecret=e2c731d2a026469aa6d218432f361653 unionRsaKey=891f6775fba7f12cc23df7c75e02b39b891f6775fba7f12c + + +#url +fileUrl=/home/project/hsg/filesystem/ +#fileUrl=/Volumes/work/code/filesystem/ diff --git a/hai-service/src/main/resources/prod-9401/commonConfig.properties b/hai-service/src/main/resources/prod-9401/commonConfig.properties index 43887e8f..a2208f9b 100644 --- a/hai-service/src/main/resources/prod-9401/commonConfig.properties +++ b/hai-service/src/main/resources/prod-9401/commonConfig.properties @@ -94,3 +94,6 @@ CyPostUrl=http://120.24.83.85:8999/ unionAppId=ced46392acfe42be863fdfdd3e61164a unionSecret=a0f380bb22cd4ce2a8d35f3bf437d6fa unionRsaKey=f2e6b6b95da445866194498c371a7c8af2e6b6b95da44586 + +#url +fileUrl=/home/project/hlt/filesystem/ diff --git a/hai-service/src/main/resources/prod/commonConfig.properties b/hai-service/src/main/resources/prod/commonConfig.properties index 15de0406..bc86281c 100644 --- a/hai-service/src/main/resources/prod/commonConfig.properties +++ b/hai-service/src/main/resources/prod/commonConfig.properties @@ -92,3 +92,6 @@ CyPostUrl=http://120.24.83.85:8999/ unionAppId=ced46392acfe42be863fdfdd3e61164a unionSecret=a0f380bb22cd4ce2a8d35f3bf437d6fa unionRsaKey=f2e6b6b95da445866194498c371a7c8af2e6b6b95da44586 + +#url +fileUrl=/home/project/hlt/filesystem/ diff --git a/v1/src/main/java/com/v1/controller/GzSinopecController.java b/v1/src/main/java/com/v1/controller/GzSinopecController.java index d501f428..ef035b1a 100644 --- a/v1/src/main/java/com/v1/controller/GzSinopecController.java +++ b/v1/src/main/java/com/v1/controller/GzSinopecController.java @@ -107,7 +107,7 @@ public class GzSinopecController { if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) { log.error("getRechargeProduct error!", "请求时间超过15分钟!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); + throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT); } // 查询电子卡券类型 @@ -186,7 +186,7 @@ public class GzSinopecController { if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) { log.error("getRechargeProduct error!", "请求时间超过15分钟!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); + throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT); } if (object.getInteger("count") > 5) { @@ -287,7 +287,7 @@ public class GzSinopecController { if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) { log.error("getRechargeProduct error!", "请求时间超过15分钟!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); + throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT); } JSONObject jsonObject = HuiLianTongConfig.getPayOrderByCouNo(object.getString("couNo")); diff --git a/v1/src/main/java/com/v1/controller/HighOrderController.java b/v1/src/main/java/com/v1/controller/HighOrderController.java index 0d36d123..d74461af 100644 --- a/v1/src/main/java/com/v1/controller/HighOrderController.java +++ b/v1/src/main/java/com/v1/controller/HighOrderController.java @@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.text.SimpleDateFormat; import java.util.HashMap; import java.util.Map; @@ -103,11 +104,14 @@ public class HighOrderController { if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) { log.error("getRechargeProduct error!", "请求时间超过15分钟!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); + throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT); } Map postMap = new HashMap<>(); postMap.put("merchId" , object.getString("merchId")); + postMap.put("createTimeS", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(object.getLong("createTimeS"))); + postMap.put("createTimeE", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(object.getLong("createTimeE"))); + return ResponseMsgUtil.success(outRechargeOrderService.getListRechargeOrder(postMap)); @@ -168,11 +172,14 @@ public class HighOrderController { if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) { log.error("getRechargeProduct error!", "请求时间超过15分钟!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); + throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT); } Map postMap = new HashMap<>(); postMap.put("merchId" , object.getString("merchId")); + postMap.put("createTimeS", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(object.getLong("createTimeS"))); + postMap.put("createTimeE", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(object.getLong("createTimeE"))); + return ResponseMsgUtil.success(highOrderService.getOrderList(postMap)); diff --git a/v1/src/main/java/com/v1/controller/RechargeProductController.java b/v1/src/main/java/com/v1/controller/RechargeProductController.java index 86f3c2a4..fc06573b 100644 --- a/v1/src/main/java/com/v1/controller/RechargeProductController.java +++ b/v1/src/main/java/com/v1/controller/RechargeProductController.java @@ -106,7 +106,7 @@ public class RechargeProductController { if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) { log.error("getRechargeProduct error!", "请求时间超过15分钟!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); + throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT); } return ResponseMsgUtil.success(apiMerchantsService.getMerchProduct(apiMerchants.getId() , object.getInteger("rechargeType"))); @@ -164,7 +164,7 @@ public class RechargeProductController { if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) { log.error("getRechargeProduct error!", "请求时间超过15分钟!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); + throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT); } return ResponseMsgUtil.success(apiMerchants.getAmounts()); @@ -224,7 +224,7 @@ public class RechargeProductController { if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) { log.error("getRechargeProduct error!", "请求时间超过15分钟!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); + throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT); } ApiOrderRecord apiOrderRecord = apiOrderRecordService.queryOrderResult(map); @@ -322,7 +322,7 @@ public class RechargeProductController { if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) { log.error("getRechargeProduct error!", "请求时间超过15分钟!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); + throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT); } apiOpenService.createOrder(object , apiMerchants , apiProductConfig); diff --git a/v1/src/main/java/com/v1/controller/SelfOilStationController.java b/v1/src/main/java/com/v1/controller/SelfOilStationController.java index f52c15d4..70622e40 100644 --- a/v1/src/main/java/com/v1/controller/SelfOilStationController.java +++ b/v1/src/main/java/com/v1/controller/SelfOilStationController.java @@ -100,7 +100,7 @@ public class SelfOilStationController { if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) { log.error("getRechargeProduct error!", "请求时间超过15分钟!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); + throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT); } SecConfig config = secConfigService.findByCodeType(object.getString("merchId")); From 35dec1eb1f74b80239b67e249acf15812225f8e2 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Tue, 23 Aug 2022 09:25:23 +0800 Subject: [PATCH 03/24] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/prod-9401/commonConfig.properties | 2 +- hai-service/src/main/resources/prod/commonConfig.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hai-service/src/main/resources/prod-9401/commonConfig.properties b/hai-service/src/main/resources/prod-9401/commonConfig.properties index a2208f9b..9442bece 100644 --- a/hai-service/src/main/resources/prod-9401/commonConfig.properties +++ b/hai-service/src/main/resources/prod-9401/commonConfig.properties @@ -96,4 +96,4 @@ unionSecret=a0f380bb22cd4ce2a8d35f3bf437d6fa unionRsaKey=f2e6b6b95da445866194498c371a7c8af2e6b6b95da44586 #url -fileUrl=/home/project/hlt/filesystem/ +fileUrl=/home/project/hsg/filesystem/ diff --git a/hai-service/src/main/resources/prod/commonConfig.properties b/hai-service/src/main/resources/prod/commonConfig.properties index bc86281c..3f002376 100644 --- a/hai-service/src/main/resources/prod/commonConfig.properties +++ b/hai-service/src/main/resources/prod/commonConfig.properties @@ -94,4 +94,4 @@ unionSecret=a0f380bb22cd4ce2a8d35f3bf437d6fa unionRsaKey=f2e6b6b95da445866194498c371a7c8af2e6b6b95da44586 #url -fileUrl=/home/project/hlt/filesystem/ +fileUrl=/home/project/hsg/filesystem/ From 7cc4dd5746ed73a2614a7c9ad6f2f83d5dbc01f9 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Tue, 23 Aug 2022 14:07:33 +0800 Subject: [PATCH 04/24] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E5=85=AC=E5=8F=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cweb/controller/WechatController.java | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/hai-cweb/src/main/java/com/cweb/controller/WechatController.java b/hai-cweb/src/main/java/com/cweb/controller/WechatController.java index 5de9c0b8..2f2db978 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/WechatController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/WechatController.java @@ -332,4 +332,41 @@ public class WechatController { } } + @RequestMapping(value = "/getH5AccessByOpenId", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "【H5】通过openId查询") + public ResponseData getH5AccessByOpenId(@RequestParam(value = "openId", required = true) String openId, + HttpServletRequest request, HttpServletResponse response) { + try { + + HighUser user = highUserService.findByOpenId(openId); + + if (user == null) { + user = new HighUser(); + user.setName("用户" + IDGenerator.nextId(5)); + user.setRegTime(new Date()); + user.setGold(0); + user.setOpenId(openId); + user.setStatus(1); + // 用户信息完整状态 + // 0:完整 + // 1:需要填写用户信息 + // 2:需要填写手机号 + user.setInfoCompleteStatus(1); + highUserService.insertUser(user , null , null); + } + + // 定义个人所有数据 + HighUserModel highUserModel = new HighUserModel(); + HighUser detailData = highUserService.getDetailDataByUser(user.getId()); + detailData.setPassword(null); + highUserModel.setHighUser(detailData); + SessionObject so = new SessionObject(user.getOpenId(), 1, highUserModel); + userCenter.save(request, response, so); + return ResponseMsgUtil.success(so); + + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } } From 0446ab4fada3c80f9ac2b5827e2c9982a726349f Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 23 Aug 2022 14:55:25 +0800 Subject: [PATCH 05/24] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/hai/service/impl/HighOrderServiceImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index 60a91e61..c21b82d6 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -1395,6 +1395,10 @@ public class HighOrderServiceImpl implements HighOrderService { // 扣预存款 this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam); } + + // 打印小票 + printGasOrder(highChildOrder.getGoodsId(), order, false); + } else if (store.getSourceType().equals(2)) { // 推送团油订单 Map paramMap = new HashMap<>(); From 3884464584b5bbe6288ade20027cd1e132f7d8ea Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Tue, 23 Aug 2022 16:38:24 +0800 Subject: [PATCH 06/24] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E5=85=AC=E5=8F=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/HighOrderServiceImpl.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index c21b82d6..5eaea6bc 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -3094,12 +3094,22 @@ public class HighOrderServiceImpl implements HighOrderService { List list = highOrderMapper.selectByExample(example); - for (HighOrder order : list) { - HighUser user = highUserService.findByUserId(order.getIdentificationCode()); - order.setTime(DateUtil.date2String(order.getCreateTime() , "MM月dd日 HH:mm")); - List childOrder = getChildOrderByOrder(order.getId()); - order.setGoodsTypeName("购买:" + GoodsType.getNameByType(childOrder.get(0).getGoodsType())); - order.setAgentName(user.getName()); + if (list.size() > 0) { + for (HighOrder order : list) { + HighUser user = highUserService.findByUserId(order.getIdentificationCode()); + order.setTime(DateUtil.date2String(order.getCreateTime() , "MM月dd日 HH:mm")); + List childOrder = getChildOrderByOrder(order.getId()); + order.setGoodsTypeName("购买:" + GoodsType.getNameByType(childOrder.get(0).getGoodsType())); + if (user != null) { + order.setAgentName(user.getName()); + } else { + if (order.getIdentificationCode() == 60) { + order.setAgentName("贵州汇联通"); + } else { + order.setAgentName("暂无推广人"); + } + } + } } return list; From ee3170150f642fd031081f06fd65bd1102b95d5f Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Tue, 23 Aug 2022 16:47:47 +0800 Subject: [PATCH 07/24] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E5=85=AC=E5=8F=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/HighOrderServiceImpl.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index 60a91e61..da6b0167 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -3085,17 +3085,23 @@ public class HighOrderServiceImpl implements HighOrderService { if (MapUtils.getLong(map , "agentId") != null) { criteria.andIdentificationCodeEqualTo(MapUtils.getLong(map , "agentId")); } else { - criteria.andIdentificationCodeIsNotNull(); + criteria.andIdentificationCodeIsNotNull().andIdentificationCodeNotEqualTo(60L); } List list = highOrderMapper.selectByExample(example); - for (HighOrder order : list) { - HighUser user = highUserService.findByUserId(order.getIdentificationCode()); - order.setTime(DateUtil.date2String(order.getCreateTime() , "MM月dd日 HH:mm")); - List childOrder = getChildOrderByOrder(order.getId()); - order.setGoodsTypeName("购买:" + GoodsType.getNameByType(childOrder.get(0).getGoodsType())); - order.setAgentName(user.getName()); + if (list.size() > 0) { + for (HighOrder order : list) { + HighUser user = highUserService.findByUserId(order.getIdentificationCode()); + order.setTime(DateUtil.date2String(order.getCreateTime() , "MM月dd日 HH:mm")); + List childOrder = getChildOrderByOrder(order.getId()); + order.setGoodsTypeName("购买:" + GoodsType.getNameByType(childOrder.get(0).getGoodsType())); + if (user != null) { + order.setAgentName(user.getName()); + } else { + order.setAgentName("暂无推广人"); + } + } } return list; From e3d7781b5a60ef9b39c32c6ba7e2598f8634ac6f Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Tue, 23 Aug 2022 16:48:36 +0800 Subject: [PATCH 08/24] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E5=85=AC=E5=8F=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hai/service/impl/HighOrderServiceImpl.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index 5eaea6bc..e055656f 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -3089,7 +3089,7 @@ public class HighOrderServiceImpl implements HighOrderService { if (MapUtils.getLong(map , "agentId") != null) { criteria.andIdentificationCodeEqualTo(MapUtils.getLong(map , "agentId")); } else { - criteria.andIdentificationCodeIsNotNull(); + criteria.andIdentificationCodeIsNotNull().andIdentificationCodeNotEqualTo(60L); } List list = highOrderMapper.selectByExample(example); @@ -3103,11 +3103,7 @@ public class HighOrderServiceImpl implements HighOrderService { if (user != null) { order.setAgentName(user.getName()); } else { - if (order.getIdentificationCode() == 60) { - order.setAgentName("贵州汇联通"); - } else { - order.setAgentName("暂无推广人"); - } + order.setAgentName("暂无推广人"); } } } From 1c8ce7bef353eee21215f8a5189a57e9484d10be Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Tue, 23 Aug 2022 17:29:38 +0800 Subject: [PATCH 09/24] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E5=85=AC=E5=8F=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/bweb/controller/BsDistributionUserRelController.java | 2 ++ .../main/java/com/hai/service/impl/HighOrderServiceImpl.java | 3 +++ 2 files changed, 5 insertions(+) diff --git a/hai-bweb/src/main/java/com/bweb/controller/BsDistributionUserRelController.java b/hai-bweb/src/main/java/com/bweb/controller/BsDistributionUserRelController.java index 1afd1921..cd59ca2f 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/BsDistributionUserRelController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/BsDistributionUserRelController.java @@ -141,12 +141,14 @@ public class BsDistributionUserRelController { @ResponseBody @ApiOperation(value = "B端查询代理商订单") public ResponseData orderListByAgentId(@RequestParam(name = "agentId", required = false) Long agentId, + @RequestParam(name = "code", required = false) Long code, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize) { try { Map map = new HashMap<>(); map.put("agentId" , agentId); + map.put("code" , code); PageHelper.startPage(pageNum,pageSize); return ResponseMsgUtil.success(new PageInfo<>(highOrderService.orderListByAgentId(map))); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index da6b0167..14fefc3e 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -3087,6 +3087,9 @@ public class HighOrderServiceImpl implements HighOrderService { } else { criteria.andIdentificationCodeIsNotNull().andIdentificationCodeNotEqualTo(60L); } + if (MapUtils.getLong(map , "code") != null) { + criteria.andIdentificationCodeEqualTo(MapUtils.getLong(map , "code")); + } List list = highOrderMapper.selectByExample(example); From c1845e01662a27b34d2919b817e0cbc47880d7f0 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Wed, 24 Aug 2022 09:10:32 +0800 Subject: [PATCH 10/24] =?UTF-8?q?1.=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/cweb/controller/WechatController.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hai-cweb/src/main/java/com/cweb/controller/WechatController.java b/hai-cweb/src/main/java/com/cweb/controller/WechatController.java index 2f2db978..9aa06379 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/WechatController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/WechatController.java @@ -339,11 +339,11 @@ public class WechatController { HttpServletRequest request, HttpServletResponse response) { try { - HighUser user = highUserService.findByOpenId(openId); + HighUser user = highUserService.findByOpenIdH5(openId); if (user == null) { user = new HighUser(); - user.setName("用户" + IDGenerator.nextId(5)); + user.setName("临时游客"); user.setRegTime(new Date()); user.setGold(0); user.setOpenId(openId); @@ -353,7 +353,7 @@ public class WechatController { // 1:需要填写用户信息 // 2:需要填写手机号 user.setInfoCompleteStatus(1); - highUserService.insertUser(user , null , null); + } // 定义个人所有数据 @@ -361,7 +361,7 @@ public class WechatController { HighUser detailData = highUserService.getDetailDataByUser(user.getId()); detailData.setPassword(null); highUserModel.setHighUser(detailData); - SessionObject so = new SessionObject(user.getOpenId(), 1, highUserModel); + SessionObject so = new SessionObject(user.getPhone(), 1, highUserModel); userCenter.save(request, response, so); return ResponseMsgUtil.success(so); From ec3fee1dd1eb4a5f6a3363b65d0ebc1744663e49 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Wed, 24 Aug 2022 22:08:47 +0800 Subject: [PATCH 11/24] 1 --- .../com/cweb/controller/WechatController.java | 20 ++++++++++--------- .../controller/pay/CzOrderController.java | 1 + 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/hai-cweb/src/main/java/com/cweb/controller/WechatController.java b/hai-cweb/src/main/java/com/cweb/controller/WechatController.java index 9aa06379..55c72c1b 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/WechatController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/WechatController.java @@ -353,17 +353,19 @@ public class WechatController { // 1:需要填写用户信息 // 2:需要填写手机号 user.setInfoCompleteStatus(1); - + return ResponseMsgUtil.success(user); + } else { + // 定义个人所有数据 + HighUserModel highUserModel = new HighUserModel(); + HighUser detailData = highUserService.getDetailDataByUser(user.getId()); + detailData.setPassword(null); + highUserModel.setHighUser(detailData); + SessionObject so = new SessionObject(user.getPhone(), 1, highUserModel); + userCenter.save(request, response, so); + return ResponseMsgUtil.success(so); } - // 定义个人所有数据 - HighUserModel highUserModel = new HighUserModel(); - HighUser detailData = highUserService.getDetailDataByUser(user.getId()); - detailData.setPassword(null); - highUserModel.setHighUser(detailData); - SessionObject so = new SessionObject(user.getPhone(), 1, highUserModel); - userCenter.save(request, response, so); - return ResponseMsgUtil.success(so); + } catch (Exception e) { return ResponseMsgUtil.exception(e); diff --git a/hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java b/hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java index 9102b614..b038b424 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java @@ -247,6 +247,7 @@ public class CzOrderController { childOrder.setStatus(101); rechargeOrder.setRechargeStatus(202); rechargeOrder.setPayStatus(100); + rechargeOrder.setFinishTime(new Date()); outRechargeOrderService.updateOrder(rechargeOrder); outRechargeChildOrderService.updateOrder(childOrder); From 6363e152c352558d895380129502daac6781337a Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Tue, 30 Aug 2022 20:47:45 +0800 Subject: [PATCH 12/24] 1 --- .../com/cweb/controller/CommonController.java | 65 ++- .../controller/pay/CzOrderController.java | 46 -- .../com/hai/schedule/HighOrderSchedule.java | 37 +- .../com/hai/dao/OutRechargeOrderMapper.java | 37 +- .../hai/dao/OutRechargeOrderMapperExt.java | 50 +++ .../hai/dao/OutRechargeOrderSqlProvider.java | 84 ++++ .../java/com/hai/entity/OutRechargeOrder.java | 87 +++- .../hai/entity/OutRechargeOrderExample.java | 400 ++++++++++++++++++ .../hai/service/BsIntegralRebateService.java | 2 + .../java/com/hai/service/CommonService.java | 11 + .../com/hai/service/HighOrderService.java | 2 +- .../hai/service/OutRechargeOrderService.java | 9 + .../impl/BsIntegralRebateServiceImpl.java | 54 ++- .../hai/service/impl/CommonServiceImpl.java | 21 +- .../service/impl/HighOrderServiceImpl.java | 9 +- .../impl/OutRechargeOrderServiceImpl.java | 33 +- v1/hai-v1.iml | 220 ++++++++++ 17 files changed, 1075 insertions(+), 92 deletions(-) create mode 100644 v1/hai-v1.iml diff --git a/hai-cweb/src/main/java/com/cweb/controller/CommonController.java b/hai-cweb/src/main/java/com/cweb/controller/CommonController.java index bd7a8438..39fe40a2 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/CommonController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/CommonController.java @@ -8,6 +8,7 @@ import com.hai.common.exception.SysCode; import com.hai.common.utils.HttpsUtils; import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.WxUtils; +import com.hai.entity.ApiCity; import com.hai.entity.BsCompany; import com.hai.entity.SecConfig; import com.hai.entity.SecRegion; @@ -285,9 +286,31 @@ public class CommonController { ) { try { - JSONObject object = commonService.findByLatAndLng(lng , lat); + JSONObject object = commonService.findByLatAndLng(lng , lat).getJSONObject("result").getJSONObject("addressComponent"); - return ResponseMsgUtil.success(object); + ApiCity apiCity = commonService.findCityByName(object.getString("city")); + + if (apiCity == null) { + log.error("findByLatAndLng error!", "当前城市暂未开通任何服务" ); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前城市暂未开通任何服务,请选择其他城市"); + } + + BsCompany company = bsCompanyService.selectCompanyByRegion(apiCity.getProvinceCode()); + + if (company == null) { + log.error("findByLatAndLng error!", "当前城市暂未开通任何服务" ); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前城市暂未开通任何服务,请选择其他城市"); + } + + JSONObject jsonObject = new JSONObject(); + + jsonObject.put("cityName" , apiCity.getCityName()); + jsonObject.put("provinceName" , apiCity.getProvinceName()); + jsonObject.put("regionId" , company.getRegionId()); + jsonObject.put("companyName" , company.getName()); + jsonObject.put("companyId" , company.getId()); + + return ResponseMsgUtil.success(jsonObject); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); @@ -295,4 +318,42 @@ public class CommonController { } } + @RequestMapping(value = "/findCompanyByCityName", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "获取定位信息") + public ResponseData findByLatAndLng( + @RequestParam(name = "cityName", required = true) String cityName + ) { + try { + + ApiCity apiCity = commonService.findCityByName(cityName); + + if (apiCity == null) { + log.error("findByLatAndLng error!", "当前城市暂未开通任何服务" ); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前城市暂未开通任何服务,请选择其他城市"); + } + + BsCompany company = bsCompanyService.selectCompanyByRegion(apiCity.getProvinceCode()); + + if (company == null) { + log.error("findByLatAndLng error!", "当前城市暂未开通任何服务" ); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前城市暂未开通任何服务,请选择其他城市"); + } + + JSONObject jsonObject = new JSONObject(); + + jsonObject.put("cityName" , apiCity.getCityName()); + jsonObject.put("provinceName" , apiCity.getProvinceName()); + jsonObject.put("regionId" , company.getRegionId()); + jsonObject.put("companyName" , company.getName()); + jsonObject.put("companyId" , company.getId()); + + return ResponseMsgUtil.success(jsonObject); + + } catch (Exception e) { + log.error("HighOrderController --> unionStagingPay() error!", e); + return ResponseMsgUtil.exception(e); + } + } + } diff --git a/hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java b/hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java index b038b424..d6838225 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java @@ -122,29 +122,6 @@ public class CzOrderController { // 判断是否充值成功 if (dataObject.getInteger("status") == 3) { new Thread(() -> { - - JSONObject object = new JSONObject(); - - object.put("type" , 3); - object.put("productId" , rechargeOrder.getOperatorType()); - object.put("companyId" , rechargeOrder.getCompanyId()); - object.put("price" , rechargeOrder.getPayRealPrice()); - object.put("userId" , rechargeOrder.getUserId()); - object.put("orderId" , rechargeOrder.getId()); - object.put("remark" , "话费订单" + rechargeOrder.getOrderNo() + "积分返利:"); - - Map map = new HashMap<>(); - map.put("goldType", 1); - map.put("resType", 4); - map.put("userId", rechargeOrder.getUserId()); - map.put("resId", rechargeOrder.getId()); - - List goldRecs = highGoldRecService.getGoldRec(map); - - if (goldRecs.size() == 0) { - bsIntegralRebateService.integralRebate(object); - } - HighUser highUser = highUserService.findByUserId(rechargeOrder.getUserId()); WxMsgConfig.rechargedSuccess( rechargeOrder.getRechargeContent() + "充值成功", @@ -212,29 +189,6 @@ public class CzOrderController { // 判断是否充值成功 if (state == 1) { new Thread(() -> { - - JSONObject object = new JSONObject(); - - object.put("type" , 3); - object.put("productId" , rechargeOrder.getOperatorType()); - object.put("companyId" , rechargeOrder.getCompanyId()); - object.put("price" , rechargeOrder.getPayRealPrice()); - object.put("userId" , rechargeOrder.getUserId()); - object.put("orderId" , rechargeOrder.getId()); - object.put("remark" , "话费订单" + rechargeOrder.getOrderNo() + "积分返利:"); - - Map map = new HashMap<>(); - map.put("goldType", 1); - map.put("resType", 4); - map.put("userId", rechargeOrder.getUserId()); - map.put("resId", rechargeOrder.getId()); - - List goldRecs = highGoldRecService.getGoldRec(map); - - if (goldRecs.size() == 0) { - bsIntegralRebateService.integralRebate(object); - } - HighUser highUser = highUserService.findByUserId(rechargeOrder.getUserId()); WxMsgConfig.rechargedSuccess( rechargeOrder.getRechargeContent() + "充值成功", diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java index eb9e7af7..0a12ccd4 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java @@ -455,7 +455,7 @@ public class HighOrderSchedule { List childOrderList = highOrderService.getChildOrderByOrder(highOrder.getId()); // 查询订单来源 - JSONObject object = highOrderService.orderSource(childOrderList.get(0).getGoodsType() , childOrderList.get(0).getGoodsId(),highOrder.getOrderNo() , highOrder.getCompanyId()); + JSONObject object = highOrderService.orderSource(childOrderList.get(0).getGoodsType() , childOrderList.get(0).getGoodsId(),highOrder.getOrderNo() , highOrder.getCompanyId() , 0); object.put("price" , highOrder.getPayRealPrice()); object.put("userId" , highOrder.getMemId()); @@ -469,5 +469,40 @@ public class HighOrderSchedule { } } + /** + * @Author Sum1Dream + * @name integralRebateOrder.java + * @Description // 执行返利操作 + * @Date 15:13 2022/8/22 + * @Param [] + * @return void + */ + @Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次 + public void integralRebateRechargeOrder() { + List order = outRechargeOrderService.integralRebateRechargeOrder(); + for (OutRechargeOrder outRechargeOrder : order) { + Map map = new HashMap<>(); + map.put("goldType", 1); + map.put("resType", 4); + map.put("userId", outRechargeOrder.getUserId()); + map.put("resId", outRechargeOrder.getId()); + + List goldRecs = highGoldRecService.getGoldRec(map); + + if (goldRecs.size() == 0) { + // 查询订单来源 + JSONObject object = highOrderService.orderSource(20 , outRechargeOrder.getGoodsId(),outRechargeOrder.getOrderNo() , outRechargeOrder.getCompanyId() , outRechargeOrder.getOperatorType()); + + object.put("price" , outRechargeOrder.getPayRealPrice()); + object.put("userId" , outRechargeOrder.getUserId()); + object.put("orderId" , outRechargeOrder.getId()); + object.put("companyId" , outRechargeOrder.getCompanyId()); + object.put("createTime" , outRechargeOrder.getCreateTimed()); + + bsIntegralRebateService.integralRechargeRebate(object); + + } + } + } } diff --git a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapper.java b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapper.java index 31a9fb7d..2eeaf604 100644 --- a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapper.java +++ b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapper.java @@ -57,7 +57,10 @@ public interface OutRechargeOrderMapper extends OutRechargeOrderMapperExt { "refund_fee, company_id, ", "pay_status, merch_id, ", "recharge_status, ext_1, ", - "ext_2, ext_3)", + "ext_2, ext_3, recharge_name, ", + "remarks, agent_key, ", + "object_id, abnormal_msg, ", + "whether_rebate)", "values (#{rechargePrice,jdbcType=DECIMAL}, #{type,jdbcType=INTEGER}, ", "#{operatorName,jdbcType=VARCHAR}, #{operatorType,jdbcType=INTEGER}, ", "#{orderNo,jdbcType=VARCHAR}, #{rechargeType,jdbcType=INTEGER}, ", @@ -76,7 +79,10 @@ public interface OutRechargeOrderMapper extends OutRechargeOrderMapperExt { "#{refundFee,jdbcType=DECIMAL}, #{companyId,jdbcType=BIGINT}, ", "#{payStatus,jdbcType=INTEGER}, #{merchId,jdbcType=VARCHAR}, ", "#{rechargeStatus,jdbcType=INTEGER}, #{ext1,jdbcType=VARCHAR}, ", - "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, #{rechargeName,jdbcType=VARCHAR}, ", + "#{remarks,jdbcType=VARCHAR}, #{agentKey,jdbcType=VARCHAR}, ", + "#{objectId,jdbcType=BIGINT}, #{abnormalMsg,jdbcType=VARCHAR}, ", + "#{whetherRebate,jdbcType=BIT})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(OutRechargeOrder record); @@ -125,7 +131,13 @@ public interface OutRechargeOrderMapper extends OutRechargeOrderMapperExt { @Result(column="recharge_status", property="rechargeStatus", jdbcType=JdbcType.INTEGER), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), - @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) + @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR), + @Result(column="recharge_name", property="rechargeName", jdbcType=JdbcType.VARCHAR), + @Result(column="remarks", property="remarks", jdbcType=JdbcType.VARCHAR), + @Result(column="agent_key", property="agentKey", jdbcType=JdbcType.VARCHAR), + @Result(column="object_id", property="objectId", jdbcType=JdbcType.BIGINT), + @Result(column="abnormal_msg", property="abnormalMsg", jdbcType=JdbcType.VARCHAR), + @Result(column="whether_rebate", property="whetherRebate", jdbcType=JdbcType.BIT) }) List selectByExample(OutRechargeOrderExample example); @@ -137,7 +149,8 @@ public interface OutRechargeOrderMapper extends OutRechargeOrderMapperExt { "integral_deduction_price, pay_price, pay_real_price, pay_serial_no, create_timed, ", "pay_time, cancel_time, finish_time, out_refund_no, order_price, refund_time, ", "tp_refund_order_no, refund_id, refund_fee, company_id, pay_status, merch_id, ", - "recharge_status, ext_1, ext_2, ext_3", + "recharge_status, ext_1, ext_2, ext_3, recharge_name, remarks, agent_key, object_id, ", + "abnormal_msg, whether_rebate", "from out_recharge_order", "where id = #{id,jdbcType=BIGINT}" }) @@ -180,7 +193,13 @@ public interface OutRechargeOrderMapper extends OutRechargeOrderMapperExt { @Result(column="recharge_status", property="rechargeStatus", jdbcType=JdbcType.INTEGER), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), - @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) + @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR), + @Result(column="recharge_name", property="rechargeName", jdbcType=JdbcType.VARCHAR), + @Result(column="remarks", property="remarks", jdbcType=JdbcType.VARCHAR), + @Result(column="agent_key", property="agentKey", jdbcType=JdbcType.VARCHAR), + @Result(column="object_id", property="objectId", jdbcType=JdbcType.BIGINT), + @Result(column="abnormal_msg", property="abnormalMsg", jdbcType=JdbcType.VARCHAR), + @Result(column="whether_rebate", property="whetherRebate", jdbcType=JdbcType.BIT) }) OutRechargeOrder selectByPrimaryKey(Long id); @@ -232,7 +251,13 @@ public interface OutRechargeOrderMapper extends OutRechargeOrderMapperExt { "recharge_status = #{rechargeStatus,jdbcType=INTEGER},", "ext_1 = #{ext1,jdbcType=VARCHAR},", "ext_2 = #{ext2,jdbcType=VARCHAR},", - "ext_3 = #{ext3,jdbcType=VARCHAR}", + "ext_3 = #{ext3,jdbcType=VARCHAR},", + "recharge_name = #{rechargeName,jdbcType=VARCHAR},", + "remarks = #{remarks,jdbcType=VARCHAR},", + "agent_key = #{agentKey,jdbcType=VARCHAR},", + "object_id = #{objectId,jdbcType=BIGINT},", + "abnormal_msg = #{abnormalMsg,jdbcType=VARCHAR},", + "whether_rebate = #{whetherRebate,jdbcType=BIT}", "where id = #{id,jdbcType=BIGINT}" }) int updateByPrimaryKey(OutRechargeOrder record); diff --git a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java index 6c2a78dd..cc0f628a 100644 --- a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java @@ -146,4 +146,54 @@ public interface OutRechargeOrderMapperExt { @Result(column="count", property="count", jdbcType=JdbcType.BIGINT), }) OrderCountModel rechargeOrderByIndex(Integer code); + + @Select("select * from out_recharge_order where recharge_status = 202 and pay_status = 100 and pay_type != 3 and pay_real_price > 0 and whether_rebate = false ") + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="recharge_price", property="rechargePrice", jdbcType=JdbcType.DECIMAL), + @Result(column="type", property="type", jdbcType=JdbcType.INTEGER), + @Result(column="operator_name", property="operatorName", jdbcType=JdbcType.VARCHAR), + @Result(column="operator_type", property="operatorType", jdbcType=JdbcType.INTEGER), + @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR), + @Result(column="recharge_type", property="rechargeType", jdbcType=JdbcType.INTEGER), + @Result(column="mem_discount_id", property="memDiscountId", jdbcType=JdbcType.BIGINT), + @Result(column="mem_discount_name", property="memDiscountName", jdbcType=JdbcType.VARCHAR), + @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), + @Result(column="user_name", property="userName", jdbcType=JdbcType.VARCHAR), + @Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR), + @Result(column="goods_id", property="goodsId", jdbcType=JdbcType.BIGINT), + @Result(column="recharge_content", property="rechargeContent", jdbcType=JdbcType.VARCHAR), + @Result(column="pay_type", property="payType", jdbcType=JdbcType.INTEGER), + @Result(column="labor_union_card", property="laborUnionCard", jdbcType=JdbcType.VARCHAR), + @Result(column="integral_num", property="integralNum", jdbcType=JdbcType.DECIMAL), + @Result(column="discount_deduction_price", property="discountDeductionPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="integral_deduction_price", property="integralDeductionPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="pay_real_price", property="payRealPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="pay_serial_no", property="paySerialNo", jdbcType=JdbcType.VARCHAR), + @Result(column="create_timed", property="createTimed", jdbcType=JdbcType.TIMESTAMP), + @Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="cancel_time", property="cancelTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="finish_time", property="finishTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="out_refund_no", property="outRefundNo", jdbcType=JdbcType.VARCHAR), + @Result(column="order_price", property="orderPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="refund_time", property="refundTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="tp_refund_order_no", property="tpRefundOrderNo", jdbcType=JdbcType.VARCHAR), + @Result(column="refund_id", property="refundId", jdbcType=JdbcType.VARCHAR), + @Result(column="refund_fee", property="refundFee", jdbcType=JdbcType.DECIMAL), + @Result(column="company_id", property="companyId", jdbcType=JdbcType.BIGINT), + @Result(column="pay_status", property="payStatus", jdbcType=JdbcType.INTEGER), + @Result(column="merch_id", property="merchId", jdbcType=JdbcType.VARCHAR), + @Result(column="recharge_status", property="rechargeStatus", jdbcType=JdbcType.INTEGER), + @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR), + @Result(column="recharge_name", property="rechargeName", jdbcType=JdbcType.VARCHAR), + @Result(column="remarks", property="remarks", jdbcType=JdbcType.VARCHAR), + @Result(column="agent_key", property="agentKey", jdbcType=JdbcType.VARCHAR), + @Result(column="object_id", property="objectId", jdbcType=JdbcType.BIGINT), + @Result(column="abnormal_msg", property="abnormalMsg", jdbcType=JdbcType.VARCHAR), + @Result(column="whether_rebate", property="whetherRebate", jdbcType=JdbcType.BIT) + }) + List integralRebateRechargeOrder(); } diff --git a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderSqlProvider.java b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderSqlProvider.java index d359e26f..9322bcd7 100644 --- a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderSqlProvider.java @@ -180,6 +180,30 @@ public class OutRechargeOrderSqlProvider { sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}"); } + if (record.getRechargeName() != null) { + sql.VALUES("recharge_name", "#{rechargeName,jdbcType=VARCHAR}"); + } + + if (record.getRemarks() != null) { + sql.VALUES("remarks", "#{remarks,jdbcType=VARCHAR}"); + } + + if (record.getAgentKey() != null) { + sql.VALUES("agent_key", "#{agentKey,jdbcType=VARCHAR}"); + } + + if (record.getObjectId() != null) { + sql.VALUES("object_id", "#{objectId,jdbcType=BIGINT}"); + } + + if (record.getAbnormalMsg() != null) { + sql.VALUES("abnormal_msg", "#{abnormalMsg,jdbcType=VARCHAR}"); + } + + if (record.getWhetherRebate() != null) { + sql.VALUES("whether_rebate", "#{whetherRebate,jdbcType=BIT}"); + } + return sql.toString(); } @@ -228,6 +252,12 @@ public class OutRechargeOrderSqlProvider { sql.SELECT("ext_1"); sql.SELECT("ext_2"); sql.SELECT("ext_3"); + sql.SELECT("recharge_name"); + sql.SELECT("remarks"); + sql.SELECT("agent_key"); + sql.SELECT("object_id"); + sql.SELECT("abnormal_msg"); + sql.SELECT("whether_rebate"); sql.FROM("out_recharge_order"); applyWhere(sql, example, false); @@ -401,6 +431,30 @@ public class OutRechargeOrderSqlProvider { sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); } + if (record.getRechargeName() != null) { + sql.SET("recharge_name = #{record.rechargeName,jdbcType=VARCHAR}"); + } + + if (record.getRemarks() != null) { + sql.SET("remarks = #{record.remarks,jdbcType=VARCHAR}"); + } + + if (record.getAgentKey() != null) { + sql.SET("agent_key = #{record.agentKey,jdbcType=VARCHAR}"); + } + + if (record.getObjectId() != null) { + sql.SET("object_id = #{record.objectId,jdbcType=BIGINT}"); + } + + if (record.getAbnormalMsg() != null) { + sql.SET("abnormal_msg = #{record.abnormalMsg,jdbcType=VARCHAR}"); + } + + if (record.getWhetherRebate() != null) { + sql.SET("whether_rebate = #{record.whetherRebate,jdbcType=BIT}"); + } + applyWhere(sql, example, true); return sql.toString(); } @@ -448,6 +502,12 @@ public class OutRechargeOrderSqlProvider { sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); + sql.SET("recharge_name = #{record.rechargeName,jdbcType=VARCHAR}"); + sql.SET("remarks = #{record.remarks,jdbcType=VARCHAR}"); + sql.SET("agent_key = #{record.agentKey,jdbcType=VARCHAR}"); + sql.SET("object_id = #{record.objectId,jdbcType=BIGINT}"); + sql.SET("abnormal_msg = #{record.abnormalMsg,jdbcType=VARCHAR}"); + sql.SET("whether_rebate = #{record.whetherRebate,jdbcType=BIT}"); OutRechargeOrderExample example = (OutRechargeOrderExample) parameter.get("example"); applyWhere(sql, example, true); @@ -610,6 +670,30 @@ public class OutRechargeOrderSqlProvider { sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}"); } + if (record.getRechargeName() != null) { + sql.SET("recharge_name = #{rechargeName,jdbcType=VARCHAR}"); + } + + if (record.getRemarks() != null) { + sql.SET("remarks = #{remarks,jdbcType=VARCHAR}"); + } + + if (record.getAgentKey() != null) { + sql.SET("agent_key = #{agentKey,jdbcType=VARCHAR}"); + } + + if (record.getObjectId() != null) { + sql.SET("object_id = #{objectId,jdbcType=BIGINT}"); + } + + if (record.getAbnormalMsg() != null) { + sql.SET("abnormal_msg = #{abnormalMsg,jdbcType=VARCHAR}"); + } + + if (record.getWhetherRebate() != null) { + sql.SET("whether_rebate = #{whetherRebate,jdbcType=BIT}"); + } + sql.WHERE("id = #{id,jdbcType=BIGINT}"); return sql.toString(); diff --git a/hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java b/hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java index 60e332b4..6bc226e1 100644 --- a/hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java +++ b/hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java @@ -85,7 +85,7 @@ public class OutRechargeOrder implements Serializable { private String rechargeContent; /** - * 1:支付宝 2:微信 3:汇联通工会卡 4:银联 5:银联分期 6:商户预充值 + * 1:支付宝 2:微信 3:汇联通工会卡 4:银联 5:银联分期 */ private Integer payType; @@ -200,6 +200,21 @@ public class OutRechargeOrder implements Serializable { private String ext3; + private String rechargeName; + + private String remarks; + + private String agentKey; + + private Long objectId; + + private String abnormalMsg; + + /** + * 是否返利 + */ + private Boolean whetherRebate; + private static final long serialVersionUID = 1L; public Long getId() { @@ -514,6 +529,54 @@ public class OutRechargeOrder implements Serializable { this.ext3 = ext3; } + public String getRechargeName() { + return rechargeName; + } + + public void setRechargeName(String rechargeName) { + this.rechargeName = rechargeName; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + public String getAgentKey() { + return agentKey; + } + + public void setAgentKey(String agentKey) { + this.agentKey = agentKey; + } + + public Long getObjectId() { + return objectId; + } + + public void setObjectId(Long objectId) { + this.objectId = objectId; + } + + public String getAbnormalMsg() { + return abnormalMsg; + } + + public void setAbnormalMsg(String abnormalMsg) { + this.abnormalMsg = abnormalMsg; + } + + public Boolean getWhetherRebate() { + return whetherRebate; + } + + public void setWhetherRebate(Boolean whetherRebate) { + this.whetherRebate = whetherRebate; + } + @Override public boolean equals(Object that) { if (this == that) { @@ -564,7 +627,13 @@ public class OutRechargeOrder implements Serializable { && (this.getRechargeStatus() == null ? other.getRechargeStatus() == null : this.getRechargeStatus().equals(other.getRechargeStatus())) && (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) && (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) - && (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())); + && (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())) + && (this.getRechargeName() == null ? other.getRechargeName() == null : this.getRechargeName().equals(other.getRechargeName())) + && (this.getRemarks() == null ? other.getRemarks() == null : this.getRemarks().equals(other.getRemarks())) + && (this.getAgentKey() == null ? other.getAgentKey() == null : this.getAgentKey().equals(other.getAgentKey())) + && (this.getObjectId() == null ? other.getObjectId() == null : this.getObjectId().equals(other.getObjectId())) + && (this.getAbnormalMsg() == null ? other.getAbnormalMsg() == null : this.getAbnormalMsg().equals(other.getAbnormalMsg())) + && (this.getWhetherRebate() == null ? other.getWhetherRebate() == null : this.getWhetherRebate().equals(other.getWhetherRebate())); } @Override @@ -610,6 +679,12 @@ public class OutRechargeOrder implements Serializable { result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode()); + result = prime * result + ((getRechargeName() == null) ? 0 : getRechargeName().hashCode()); + result = prime * result + ((getRemarks() == null) ? 0 : getRemarks().hashCode()); + result = prime * result + ((getAgentKey() == null) ? 0 : getAgentKey().hashCode()); + result = prime * result + ((getObjectId() == null) ? 0 : getObjectId().hashCode()); + result = prime * result + ((getAbnormalMsg() == null) ? 0 : getAbnormalMsg().hashCode()); + result = prime * result + ((getWhetherRebate() == null) ? 0 : getWhetherRebate().hashCode()); return result; } @@ -658,8 +733,14 @@ public class OutRechargeOrder implements Serializable { sb.append(", ext1=").append(ext1); sb.append(", ext2=").append(ext2); sb.append(", ext3=").append(ext3); + sb.append(", rechargeName=").append(rechargeName); + sb.append(", remarks=").append(remarks); + sb.append(", agentKey=").append(agentKey); + sb.append(", objectId=").append(objectId); + sb.append(", abnormalMsg=").append(abnormalMsg); + sb.append(", whetherRebate=").append(whetherRebate); sb.append(", serialVersionUID=").append(serialVersionUID); sb.append("]"); return sb.toString(); } -} +} \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/entity/OutRechargeOrderExample.java b/hai-service/src/main/java/com/hai/entity/OutRechargeOrderExample.java index 418b45b4..e7cba03f 100644 --- a/hai-service/src/main/java/com/hai/entity/OutRechargeOrderExample.java +++ b/hai-service/src/main/java/com/hai/entity/OutRechargeOrderExample.java @@ -2615,6 +2615,406 @@ public class OutRechargeOrderExample { addCriterion("ext_3 not between", value1, value2, "ext3"); return (Criteria) this; } + + public Criteria andRechargeNameIsNull() { + addCriterion("recharge_name is null"); + return (Criteria) this; + } + + public Criteria andRechargeNameIsNotNull() { + addCriterion("recharge_name is not null"); + return (Criteria) this; + } + + public Criteria andRechargeNameEqualTo(String value) { + addCriterion("recharge_name =", value, "rechargeName"); + return (Criteria) this; + } + + public Criteria andRechargeNameNotEqualTo(String value) { + addCriterion("recharge_name <>", value, "rechargeName"); + return (Criteria) this; + } + + public Criteria andRechargeNameGreaterThan(String value) { + addCriterion("recharge_name >", value, "rechargeName"); + return (Criteria) this; + } + + public Criteria andRechargeNameGreaterThanOrEqualTo(String value) { + addCriterion("recharge_name >=", value, "rechargeName"); + return (Criteria) this; + } + + public Criteria andRechargeNameLessThan(String value) { + addCriterion("recharge_name <", value, "rechargeName"); + return (Criteria) this; + } + + public Criteria andRechargeNameLessThanOrEqualTo(String value) { + addCriterion("recharge_name <=", value, "rechargeName"); + return (Criteria) this; + } + + public Criteria andRechargeNameLike(String value) { + addCriterion("recharge_name like", value, "rechargeName"); + return (Criteria) this; + } + + public Criteria andRechargeNameNotLike(String value) { + addCriterion("recharge_name not like", value, "rechargeName"); + return (Criteria) this; + } + + public Criteria andRechargeNameIn(List values) { + addCriterion("recharge_name in", values, "rechargeName"); + return (Criteria) this; + } + + public Criteria andRechargeNameNotIn(List values) { + addCriterion("recharge_name not in", values, "rechargeName"); + return (Criteria) this; + } + + public Criteria andRechargeNameBetween(String value1, String value2) { + addCriterion("recharge_name between", value1, value2, "rechargeName"); + return (Criteria) this; + } + + public Criteria andRechargeNameNotBetween(String value1, String value2) { + addCriterion("recharge_name not between", value1, value2, "rechargeName"); + return (Criteria) this; + } + + public Criteria andRemarksIsNull() { + addCriterion("remarks is null"); + return (Criteria) this; + } + + public Criteria andRemarksIsNotNull() { + addCriterion("remarks is not null"); + return (Criteria) this; + } + + public Criteria andRemarksEqualTo(String value) { + addCriterion("remarks =", value, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksNotEqualTo(String value) { + addCriterion("remarks <>", value, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksGreaterThan(String value) { + addCriterion("remarks >", value, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksGreaterThanOrEqualTo(String value) { + addCriterion("remarks >=", value, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksLessThan(String value) { + addCriterion("remarks <", value, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksLessThanOrEqualTo(String value) { + addCriterion("remarks <=", value, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksLike(String value) { + addCriterion("remarks like", value, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksNotLike(String value) { + addCriterion("remarks not like", value, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksIn(List values) { + addCriterion("remarks in", values, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksNotIn(List values) { + addCriterion("remarks not in", values, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksBetween(String value1, String value2) { + addCriterion("remarks between", value1, value2, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksNotBetween(String value1, String value2) { + addCriterion("remarks not between", value1, value2, "remarks"); + return (Criteria) this; + } + + public Criteria andAgentKeyIsNull() { + addCriterion("agent_key is null"); + return (Criteria) this; + } + + public Criteria andAgentKeyIsNotNull() { + addCriterion("agent_key is not null"); + return (Criteria) this; + } + + public Criteria andAgentKeyEqualTo(String value) { + addCriterion("agent_key =", value, "agentKey"); + return (Criteria) this; + } + + public Criteria andAgentKeyNotEqualTo(String value) { + addCriterion("agent_key <>", value, "agentKey"); + return (Criteria) this; + } + + public Criteria andAgentKeyGreaterThan(String value) { + addCriterion("agent_key >", value, "agentKey"); + return (Criteria) this; + } + + public Criteria andAgentKeyGreaterThanOrEqualTo(String value) { + addCriterion("agent_key >=", value, "agentKey"); + return (Criteria) this; + } + + public Criteria andAgentKeyLessThan(String value) { + addCriterion("agent_key <", value, "agentKey"); + return (Criteria) this; + } + + public Criteria andAgentKeyLessThanOrEqualTo(String value) { + addCriterion("agent_key <=", value, "agentKey"); + return (Criteria) this; + } + + public Criteria andAgentKeyLike(String value) { + addCriterion("agent_key like", value, "agentKey"); + return (Criteria) this; + } + + public Criteria andAgentKeyNotLike(String value) { + addCriterion("agent_key not like", value, "agentKey"); + return (Criteria) this; + } + + public Criteria andAgentKeyIn(List values) { + addCriterion("agent_key in", values, "agentKey"); + return (Criteria) this; + } + + public Criteria andAgentKeyNotIn(List values) { + addCriterion("agent_key not in", values, "agentKey"); + return (Criteria) this; + } + + public Criteria andAgentKeyBetween(String value1, String value2) { + addCriterion("agent_key between", value1, value2, "agentKey"); + return (Criteria) this; + } + + public Criteria andAgentKeyNotBetween(String value1, String value2) { + addCriterion("agent_key not between", value1, value2, "agentKey"); + return (Criteria) this; + } + + public Criteria andObjectIdIsNull() { + addCriterion("object_id is null"); + return (Criteria) this; + } + + public Criteria andObjectIdIsNotNull() { + addCriterion("object_id is not null"); + return (Criteria) this; + } + + public Criteria andObjectIdEqualTo(Long value) { + addCriterion("object_id =", value, "objectId"); + return (Criteria) this; + } + + public Criteria andObjectIdNotEqualTo(Long value) { + addCriterion("object_id <>", value, "objectId"); + return (Criteria) this; + } + + public Criteria andObjectIdGreaterThan(Long value) { + addCriterion("object_id >", value, "objectId"); + return (Criteria) this; + } + + public Criteria andObjectIdGreaterThanOrEqualTo(Long value) { + addCriterion("object_id >=", value, "objectId"); + return (Criteria) this; + } + + public Criteria andObjectIdLessThan(Long value) { + addCriterion("object_id <", value, "objectId"); + return (Criteria) this; + } + + public Criteria andObjectIdLessThanOrEqualTo(Long value) { + addCriterion("object_id <=", value, "objectId"); + return (Criteria) this; + } + + public Criteria andObjectIdIn(List values) { + addCriterion("object_id in", values, "objectId"); + return (Criteria) this; + } + + public Criteria andObjectIdNotIn(List values) { + addCriterion("object_id not in", values, "objectId"); + return (Criteria) this; + } + + public Criteria andObjectIdBetween(Long value1, Long value2) { + addCriterion("object_id between", value1, value2, "objectId"); + return (Criteria) this; + } + + public Criteria andObjectIdNotBetween(Long value1, Long value2) { + addCriterion("object_id not between", value1, value2, "objectId"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgIsNull() { + addCriterion("abnormal_msg is null"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgIsNotNull() { + addCriterion("abnormal_msg is not null"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgEqualTo(String value) { + addCriterion("abnormal_msg =", value, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgNotEqualTo(String value) { + addCriterion("abnormal_msg <>", value, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgGreaterThan(String value) { + addCriterion("abnormal_msg >", value, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgGreaterThanOrEqualTo(String value) { + addCriterion("abnormal_msg >=", value, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgLessThan(String value) { + addCriterion("abnormal_msg <", value, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgLessThanOrEqualTo(String value) { + addCriterion("abnormal_msg <=", value, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgLike(String value) { + addCriterion("abnormal_msg like", value, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgNotLike(String value) { + addCriterion("abnormal_msg not like", value, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgIn(List values) { + addCriterion("abnormal_msg in", values, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgNotIn(List values) { + addCriterion("abnormal_msg not in", values, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgBetween(String value1, String value2) { + addCriterion("abnormal_msg between", value1, value2, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgNotBetween(String value1, String value2) { + addCriterion("abnormal_msg not between", value1, value2, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andWhetherRebateIsNull() { + addCriterion("whether_rebate is null"); + return (Criteria) this; + } + + public Criteria andWhetherRebateIsNotNull() { + addCriterion("whether_rebate is not null"); + return (Criteria) this; + } + + public Criteria andWhetherRebateEqualTo(Boolean value) { + addCriterion("whether_rebate =", value, "whetherRebate"); + return (Criteria) this; + } + + public Criteria andWhetherRebateNotEqualTo(Boolean value) { + addCriterion("whether_rebate <>", value, "whetherRebate"); + return (Criteria) this; + } + + public Criteria andWhetherRebateGreaterThan(Boolean value) { + addCriterion("whether_rebate >", value, "whetherRebate"); + return (Criteria) this; + } + + public Criteria andWhetherRebateGreaterThanOrEqualTo(Boolean value) { + addCriterion("whether_rebate >=", value, "whetherRebate"); + return (Criteria) this; + } + + public Criteria andWhetherRebateLessThan(Boolean value) { + addCriterion("whether_rebate <", value, "whetherRebate"); + return (Criteria) this; + } + + public Criteria andWhetherRebateLessThanOrEqualTo(Boolean value) { + addCriterion("whether_rebate <=", value, "whetherRebate"); + return (Criteria) this; + } + + public Criteria andWhetherRebateIn(List values) { + addCriterion("whether_rebate in", values, "whetherRebate"); + return (Criteria) this; + } + + public Criteria andWhetherRebateNotIn(List values) { + addCriterion("whether_rebate not in", values, "whetherRebate"); + return (Criteria) this; + } + + public Criteria andWhetherRebateBetween(Boolean value1, Boolean value2) { + addCriterion("whether_rebate between", value1, value2, "whetherRebate"); + return (Criteria) this; + } + + public Criteria andWhetherRebateNotBetween(Boolean value1, Boolean value2) { + addCriterion("whether_rebate not between", value1, value2, "whetherRebate"); + return (Criteria) this; + } } /** diff --git a/hai-service/src/main/java/com/hai/service/BsIntegralRebateService.java b/hai-service/src/main/java/com/hai/service/BsIntegralRebateService.java index fd73ed1c..6091be72 100644 --- a/hai-service/src/main/java/com/hai/service/BsIntegralRebateService.java +++ b/hai-service/src/main/java/com/hai/service/BsIntegralRebateService.java @@ -79,4 +79,6 @@ public interface BsIntegralRebateService { void integralRebate(JSONObject object); + void integralRechargeRebate(JSONObject object); + } diff --git a/hai-service/src/main/java/com/hai/service/CommonService.java b/hai-service/src/main/java/com/hai/service/CommonService.java index 21926282..e79dfd4a 100644 --- a/hai-service/src/main/java/com/hai/service/CommonService.java +++ b/hai-service/src/main/java/com/hai/service/CommonService.java @@ -8,6 +8,7 @@ package com.hai.service; */ import com.alibaba.fastjson.JSONObject; +import com.hai.entity.ApiCity; import com.hai.entity.SecDictionary; import com.hai.entity.SecRegion; import com.hai.model.IndexCountModel; @@ -282,4 +283,14 @@ public interface CommonService { */ void configPlatform(JSONObject object); + /** + * @Author Sum1Dream + * @name findCityByName.java + * @Description // 根据名称查询城市 + * @Date 15:00 2022/5/12 + * @Param [String name] + * @return void + */ + ApiCity findCityByName(String name); + } diff --git a/hai-service/src/main/java/com/hai/service/HighOrderService.java b/hai-service/src/main/java/com/hai/service/HighOrderService.java index 69b18dca..bcc36c5c 100644 --- a/hai-service/src/main/java/com/hai/service/HighOrderService.java +++ b/hai-service/src/main/java/com/hai/service/HighOrderService.java @@ -561,7 +561,7 @@ public interface HighOrderService { * @Param [java.lang.Integer, java.lang.Long] * @return com.alibaba.fastjson.JSONObject */ - JSONObject orderSource(Integer goodsType , Long goodsId , String orderNo , Long companyId); + JSONObject orderSource(Integer goodsType , Long goodsId , String orderNo , Long companyId , Integer productId); /** * @Author Sum1Dream diff --git a/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java b/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java index b47cddec..d0b735d6 100644 --- a/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java +++ b/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java @@ -176,5 +176,14 @@ public interface OutRechargeOrderService { */ Integer rechargeOrderNum(Long userId); + /** + * @Author Sum1Dream + * @name integralRebateRechargeOrder.java + * @Description // 查询话费未返利订单 + * @Date 17:49 2022/5/30 + * @Param [java.lang.Long] + * @return java.lang.Integer + */ + List integralRebateRechargeOrder(); } diff --git a/hai-service/src/main/java/com/hai/service/impl/BsIntegralRebateServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/BsIntegralRebateServiceImpl.java index a3eef794..6f64041d 100644 --- a/hai-service/src/main/java/com/hai/service/impl/BsIntegralRebateServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/BsIntegralRebateServiceImpl.java @@ -6,10 +6,8 @@ import com.hai.dao.BsIntegralRebateMapper; import com.hai.entity.BsIntegralRebate; import com.hai.entity.BsIntegralRebateExample; import com.hai.entity.HighOrder; -import com.hai.service.BsDistributionUserRelService; -import com.hai.service.BsIntegralRebateService; -import com.hai.service.HighOrderService; -import com.hai.service.HighUserService; +import com.hai.entity.OutRechargeOrder; +import com.hai.service.*; import org.apache.commons.collections4.MapUtils; import org.springframework.stereotype.Service; @@ -31,6 +29,9 @@ public class BsIntegralRebateServiceImpl implements BsIntegralRebateService { @Resource private HighOrderService highOrderService; + @Resource + private OutRechargeOrderService outRechargeOrderService; + @Resource private BsDistributionUserRelService bsDistributionUserRelService; @@ -140,4 +141,49 @@ public class BsIntegralRebateServiceImpl implements BsIntegralRebateService { } } + + @Override + public void integralRechargeRebate(JSONObject object) { + + Map map = new HashMap<>(); + map.put("type" , object.getInteger("type")); + map.put("productId" , object.getLong("productId")); + map.put("companyId" , object.getLong("companyId")); + + if (object.getLong("companyId") != null) { + + BsIntegralRebate bsIntegralRebate = findIntegralRebateByMap(map); + + if (DateUtil.isEffectiveDate(object.getDate("createTime"), bsIntegralRebate.getStartTime() , bsIntegralRebate.getEndTime())) { + JSONObject jsonObject = new JSONObject(); + OutRechargeOrder order = outRechargeOrderService.findByOrderId(object.getLong("orderId")); + + order.setWhetherRebate(true); + + BigDecimal integralNum = object.getBigDecimal("price").multiply(bsIntegralRebate.getPercentage()).setScale( 0, BigDecimal.ROUND_HALF_UP ); + if (bsIntegralRebate.getFirstDistribution() !=null) { + BigDecimal integralNumFirst = object.getBigDecimal("price").multiply(bsIntegralRebate.getFirstDistribution()).setScale( 0, BigDecimal.ROUND_HALF_UP ); + jsonObject.put("integralNumFirst" , integralNumFirst); + } + if (bsIntegralRebate.getSecondDistribution() !=null) { + BigDecimal integralNumSecond = object.getBigDecimal("price").multiply(bsIntegralRebate.getSecondDistribution()).setScale( 0, BigDecimal.ROUND_HALF_UP ); + jsonObject.put("integralNumSecond" , integralNumSecond); + } + + order.setWhetherRebate(true); + + jsonObject.put("title" , object.getString("name")); + jsonObject.put("orderNo" , order.getOrderNo()); + jsonObject.put("userId" , object.getLong("userId")); + jsonObject.put("logoImg" , object.getString("logoImg")); + + bsDistributionUserRelService.distributionRebate(jsonObject); + outRechargeOrderService.updateOrder(order); + highUserService.goldHandle(object.getLong("userId"), integralNum.intValue(), 1, 4, object.getLong("orderId") , object.getString("remark") + integralNum); + + } + + } + + } } diff --git a/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java index 80ea1313..25e37784 100644 --- a/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java @@ -65,6 +65,9 @@ public class CommonServiceImpl implements CommonService { @Resource private BsProductPayTypeMapper bsProductPayTypeMapper; + @Resource + private ApiCityMapper apiCityMapper; + private Map> dicCache = new HashMap>(); private List citiesCache = new ArrayList<>(); @@ -617,7 +620,21 @@ public class CommonServiceImpl implements CommonService { } } - // 清空支付方式配置 + @Override + public ApiCity findCityByName(String name) { + ApiCityExample example = new ApiCityExample(); + example.createCriteria().andCityNameEqualTo(name); + + List list = apiCityMapper.selectByExample(example); + + if (list.size()>0) { + return list.get(0); + } + + return null; + } + + // 清空支付方式配置 private void deletePayType(Long sourceId) { if (sourceId == null) { @@ -676,4 +693,6 @@ public class CommonServiceImpl implements CommonService { } } + + } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index cb3d2e10..ad812c72 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -3010,7 +3010,7 @@ public class HighOrderServiceImpl implements HighOrderService { } @Override - public JSONObject orderSource(Integer goodsType, Long goodsId , String orderNo , Long companyId) { + public JSONObject orderSource(Integer goodsType, Long goodsId , String orderNo , Long companyId , Integer productId) { JSONObject object = new JSONObject(); @@ -3054,6 +3054,13 @@ public class HighOrderServiceImpl implements HighOrderService { object.put("remark" , "会员充值订单" + orderNo + "积分返利:"); object.put("name" , "购买会员充值产品"); } + if (goodsType == 20) { + object.put("type" , 3); + object.put("productId", productId); + object.put("companyId", companyId); + object.put("remark" , "话费充值订单" + orderNo + "积分返利:"); + object.put("name" , "购买话费充值产品"); + } object.put("logoImg" , OrderLogoEnum.getNameByImgUrl(goodsType)); return object; diff --git a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java index d574e491..83403cf9 100644 --- a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java @@ -322,6 +322,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { outRechargeOrder.setOrderNo("RCG" + DateUtil.date2String(new Date(), "yyyyMMddHHmmss") + IDGenerator.nextId(5)); outRechargeOrder.setCreateTimed(new Date()); outRechargeOrder.setGoodsId(goodsId); + outRechargeOrder.setWhetherRebate(false); outRechargeOrder.setMerchId(object.getString("mchId")); outRechargeOrder.setRechargePrice(outRechargePrice.getRechargePrice()); if (object.getLong("memDiscountId") != null) { @@ -435,33 +436,6 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { public void finishOrder(Long orderId) { OutRechargeOrder order = findByOrderId(orderId); if (order != null) { - - new Thread(() -> { - JSONObject object = new JSONObject(); - - object.put("type" , 3); - object.put("productId" , order.getOperatorType()); - object.put("companyId" , order.getCompanyId()); - object.put("price" , order.getPayRealPrice()); - object.put("userId" , order.getUserId()); - object.put("orderId" , order.getId()); - object.put("remark" , "话费订单" + order.getOrderNo() + "积分返利:"); - - - Map map = new HashMap<>(); - map.put("goldType", 1); - map.put("resType", 4); - map.put("userId", order.getUserId()); - map.put("resId", order.getId()); - - List goldRecs = highGoldRecService.getGoldRec(map); - - if (goldRecs.size() == 0) { - bsIntegralRebateService.integralRebate(object); - } - - }).start(); - order.setRechargeStatus(202); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已取消 5.已退款 order.setPayStatus(100); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已取消 5.已退款 order.setFinishTime(new Date()); @@ -1004,4 +978,9 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { return outRechargeOrderMapper.selectByExample(example).size(); } + @Override + public List integralRebateRechargeOrder() { + return outRechargeOrderMapper.integralRebateRechargeOrder(); + } + } diff --git a/v1/hai-v1.iml b/v1/hai-v1.iml new file mode 100644 index 00000000..9ecb2698 --- /dev/null +++ b/v1/hai-v1.iml @@ -0,0 +1,220 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 497a7a30af8eb1c50716dd991812d1e456d3101f Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Fri, 2 Sep 2022 13:47:49 +0800 Subject: [PATCH 13/24] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E5=85=AC=E5=8F=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/HighApproveController.java | 34 ++++++ .../bweb/controller/HighCouponController.java | 23 ++++ .../OutRechargeOrderController.java | 2 + .../com/cweb/controller/CommonController.java | 56 +++++++-- .../controller/HighThirdPartyController.java | 2 + hai-cweb/src/main/resources/dev/logback.xml | 2 +- .../src/main/resources/prod/logback.xml | 2 +- .../java/com/hai/common/utils/WxUtils.java | 2 + .../com/hai/entity/ApiStarbucksProducts.java | 12 +- .../main/java/com/hai/entity/HighApprove.java | 4 +- .../java/com/hai/enum_type/ApproveType.java | 3 +- .../hai/service/BsIntegralRebateService.java | 16 +++ .../com/hai/service/HighCouponService.java | 17 +++ .../service/impl/HighApproveServiceImpl.java | 23 +++- .../impl/HighCouponAgentServiceImpl.java | 2 +- .../service/impl/HighCouponServiceImpl.java | 112 ++++++++++++++++++ .../impl/OutRechargeOrderServiceImpl.java | 13 ++ .../main/java/com/v1/config/AuthConfig.java | 1 + v1/src/main/java/com/v1/config/SysConfig.java | 17 +++ .../com/v1/controller/WxMsgController.java | 92 ++++++++++++++ v1/src/main/resources/dev/config.properties | 2 + v1/src/main/resources/dev/logback.xml | 3 + 22 files changed, 418 insertions(+), 22 deletions(-) create mode 100644 v1/src/main/java/com/v1/controller/WxMsgController.java diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighApproveController.java b/hai-bweb/src/main/java/com/bweb/controller/HighApproveController.java index d9eb314b..6ef83480 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighApproveController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighApproveController.java @@ -8,6 +8,7 @@ import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.security.SessionObject; import com.hai.common.security.UserCenter; +import com.hai.common.utils.DateUtil; import com.hai.common.utils.ResponseMsgUtil; import com.hai.entity.HighApprove; import com.hai.enum_type.ApproveType; @@ -145,4 +146,37 @@ public class HighApproveController { return ResponseMsgUtil.exception(e); } } + + @RequestMapping(value="/addApprove",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "添加审批") + public ResponseData addApprove(@RequestBody JSONObject object ,HttpServletRequest request) { + try { + + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + + HighApprove approve = new HighApprove(); + + approve.setObjectId(99L); + approve.setObjectName("卡券分发审批"); + approve.setApproveSerialNo(DateUtil.date2String(new Date(), "yyyyMMddHHmmss")); + approve.setStatus(1); + approve.setCreateTime(new Date()); + approve.setUpdateTime(new Date()); + approve.setSubmitOperatorId(userInfoModel.getSecUser().getId()); + approve.setSubmitOperatorName(userInfoModel.getSecUser().getUserName()); + approve.setObjectType(object.getInteger("objectType")); + approve.setApproveObject(object.getJSONObject("approveObject").toJSONString()); + + highApproveService.insertApprove(approve); + + return ResponseMsgUtil.success("操作成功"); + + } catch (Exception e) { + log.error("HighCouponController -> approveProcessed() error!",e); + return ResponseMsgUtil.exception(e); + } + } + } diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java b/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java index 66ecb190..8977e0a3 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java @@ -768,4 +768,27 @@ public class HighCouponController { } } + @RequestMapping(value="/getCouponListByAll",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询所有卡卷列表") + public ResponseData getCouponListByAll(HttpServletRequest request) { + try { + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + if (userInfoModel.getBsCompany() == null) { + log.error("HighCouponController -> getCouponList() error!","权限不足"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); + } + + Map map = new HashMap<>(3); + map.put("companyId", userInfoModel.getBsCompany().getId()); + map.put("status", 2); + + return ResponseMsgUtil.success(highCouponService.getCouponListByAll(map)); + } catch (Exception e) { + log.error("HighCouponController -> getCouponList() error!",e); + return ResponseMsgUtil.exception(e); + } + } + } diff --git a/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java b/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java index 344955be..1d771bb4 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java @@ -144,6 +144,7 @@ public class OutRechargeOrderController { @RequestParam(name = "payType", required = false) Integer payType, @RequestParam(name = "payTimeS", required = false) Long payTimeS, @RequestParam(name = "payTimeE", required = false) Long payTimeE, + @RequestParam(name = "whetherTimeOut", required = false) Boolean whetherTimeOut, @RequestParam(name = "createTimeS", required = false) Long createTimeS, @RequestParam(name = "createTimeE", required = false) Long createTimeE, @RequestParam(name = "pageNum", required = true) Integer pageNum, @@ -169,6 +170,7 @@ public class OutRechargeOrderController { map.put("rechargeStatus", rechargeStatus); map.put("payStatus", payStatus); map.put("orderNo", orderNo); + map.put("whetherTimeOut", whetherTimeOut); map.put("operatorType", operatorType); map.put("laborUnionCard", laborUnionCard); map.put("rechargeContent", rechargeContent); diff --git a/hai-cweb/src/main/java/com/cweb/controller/CommonController.java b/hai-cweb/src/main/java/com/cweb/controller/CommonController.java index 39fe40a2..c81e4c34 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/CommonController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/CommonController.java @@ -8,14 +8,9 @@ import com.hai.common.exception.SysCode; import com.hai.common.utils.HttpsUtils; import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.WxUtils; -import com.hai.entity.ApiCity; -import com.hai.entity.BsCompany; -import com.hai.entity.SecConfig; -import com.hai.entity.SecRegion; +import com.hai.entity.*; import com.hai.model.ResponseData; -import com.hai.service.BsCompanyService; -import com.hai.service.CommonService; -import com.hai.service.SecConfigService; +import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import me.chanjar.weixin.common.util.crypto.SHA1; @@ -25,6 +20,7 @@ import org.slf4j.LoggerFactory; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -47,6 +43,11 @@ public class CommonController { @Resource private BsCompanyService bsCompanyService; + @Resource + private HighOrderService highOrderService; + + @Resource + private BsIntegralRebateService bsIntegralRebateService; @RequestMapping(value="/getDredgeProvince",method= RequestMethod.GET) @ResponseBody @@ -231,7 +232,7 @@ public class CommonController { } } - @RequestMapping(value = "/getScanCodePageHtmlSign", method = RequestMethod.POST) + @RequestMapping(value = "/ getScanCodePageHtmlSign", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "获取扫码页面签名") public ResponseData getScanCodePageHtmlSign(@RequestBody JSONObject body) { @@ -321,7 +322,7 @@ public class CommonController { @RequestMapping(value = "/findCompanyByCityName", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取定位信息") - public ResponseData findByLatAndLng( + public ResponseData findCompanyByCityName( @RequestParam(name = "cityName", required = true) String cityName ) { try { @@ -356,4 +357,41 @@ public class CommonController { } } + @RequestMapping(value = "/getRebateIntegral", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "查询可获取返利积分") + public ResponseData getRebateIntegral(@RequestBody JSONObject object) { + try { + + if (object.getInteger("type") == null || + object.getLong("companyId") == null || + object.getLong("productId") == null || + object.getBigDecimal("price") == null + ) { + log.error("CommonController -> getRebateIntegral() error!","请求参数校验失败"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR); + } + + // 查询订单来源 + Map map = new HashMap<>(); + map.put("type" , object.getInteger("type")); + map.put("productId" , object.getLong("productId")); + map.put("companyId" , object.getLong("companyId")); + + BsIntegralRebate bsIntegralRebate = bsIntegralRebateService.findIntegralRebateByMap(map); + + if (bsIntegralRebate == null) { + throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无积分返利活动"); + } + + BigDecimal integralNum = object.getBigDecimal("price").multiply(bsIntegralRebate.getPercentage()).setScale( 0, BigDecimal.ROUND_HALF_UP ); + + return ResponseMsgUtil.success(integralNum); + + } catch (Exception e) { + log.error("HighOrderController --> unionStagingPay() error!", e); + return ResponseMsgUtil.exception(e); + } + } + } diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java b/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java index 1f7a0e8b..1422f099 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java @@ -129,6 +129,7 @@ public class HighThirdPartyController { } apiStarbucksProducts.setSalesVentiPrice(salesVentiPrice); apiStarbucksProducts.setSalesTallPrice(salesTallPrice); + apiStarbucksProducts.setCount(0); apiStarbucksProducts.setSalesGrandePrice(salesGrandePrice); starbucksProductsList.add(apiStarbucksProducts); } @@ -241,6 +242,7 @@ public class HighThirdPartyController { salePriceF = productsObject.getBigDecimal("originalPrice"); } productsObject.put("salePrice", salePriceF); + productsObject.put("count" , 0); if (productsObject.getJSONArray("specGroups") != null) { for (Object specGroups : productsObject.getJSONArray("specGroups")) { diff --git a/hai-cweb/src/main/resources/dev/logback.xml b/hai-cweb/src/main/resources/dev/logback.xml index a7602e3d..dcda78c9 100644 --- a/hai-cweb/src/main/resources/dev/logback.xml +++ b/hai-cweb/src/main/resources/dev/logback.xml @@ -60,7 +60,7 @@ - + diff --git a/hai-schedule/src/main/resources/prod/logback.xml b/hai-schedule/src/main/resources/prod/logback.xml index 516350df..f33cbad8 100644 --- a/hai-schedule/src/main/resources/prod/logback.xml +++ b/hai-schedule/src/main/resources/prod/logback.xml @@ -60,7 +60,7 @@ - + diff --git a/hai-service/src/main/java/com/hai/common/utils/WxUtils.java b/hai-service/src/main/java/com/hai/common/utils/WxUtils.java index 7652c17d..6aac9c4c 100644 --- a/hai-service/src/main/java/com/hai/common/utils/WxUtils.java +++ b/hai-service/src/main/java/com/hai/common/utils/WxUtils.java @@ -488,7 +488,9 @@ public class WxUtils { continue; } if (data.get(k) != null) // 参数值为空,则不参与签名 + { sb.append(k).append("=").append(data.get(k)).append("&"); + } } sb.append("apiKey=").append(key); if (WXPayConstants.SignType.MD5.equals(signType)) { diff --git a/hai-service/src/main/java/com/hai/entity/ApiStarbucksProducts.java b/hai-service/src/main/java/com/hai/entity/ApiStarbucksProducts.java index 4125646c..ea2e6d26 100644 --- a/hai-service/src/main/java/com/hai/entity/ApiStarbucksProducts.java +++ b/hai-service/src/main/java/com/hai/entity/ApiStarbucksProducts.java @@ -129,6 +129,8 @@ public class ApiStarbucksProducts implements Serializable { */ private Integer status; + private Integer count; + /** * ext_1 */ @@ -144,6 +146,14 @@ public class ApiStarbucksProducts implements Serializable { */ private String ext3; + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + private static final long serialVersionUID = 1L; public Long getId() { @@ -463,4 +473,4 @@ public class ApiStarbucksProducts implements Serializable { sb.append("]"); return sb.toString(); } -} \ No newline at end of file +} diff --git a/hai-service/src/main/java/com/hai/entity/HighApprove.java b/hai-service/src/main/java/com/hai/entity/HighApprove.java index faef4315..6f9b4718 100644 --- a/hai-service/src/main/java/com/hai/entity/HighApprove.java +++ b/hai-service/src/main/java/com/hai/entity/HighApprove.java @@ -19,7 +19,7 @@ public class HighApprove implements Serializable { private Long id; /** - * 审批对象 1:卡券上架审批 2:卡卷价格审批 + * 审批对象 1:卡券上架审批 2:卡卷价格审批 3:卡券分发审批 */ private Integer objectType; @@ -309,4 +309,4 @@ public class HighApprove implements Serializable { sb.append("]"); return sb.toString(); } -} \ No newline at end of file +} diff --git a/hai-service/src/main/java/com/hai/enum_type/ApproveType.java b/hai-service/src/main/java/com/hai/enum_type/ApproveType.java index ce26d044..c9cb77fc 100644 --- a/hai-service/src/main/java/com/hai/enum_type/ApproveType.java +++ b/hai-service/src/main/java/com/hai/enum_type/ApproveType.java @@ -7,7 +7,8 @@ package com.hai.enum_type; */ public enum ApproveType { UP_SHELF_APPROVE(1, "卡卷上架审批"), - COUPON_PRICE_APPROVE(2, "卡卷价格审批") + COUPON_PRICE_APPROVE(2, "卡卷价格审批"), + COUPON_DISTRIBUTE_APPROVE(3, "卡卷分发审批"), ; private Integer type; diff --git a/hai-service/src/main/java/com/hai/service/BsIntegralRebateService.java b/hai-service/src/main/java/com/hai/service/BsIntegralRebateService.java index 6091be72..d59c62f0 100644 --- a/hai-service/src/main/java/com/hai/service/BsIntegralRebateService.java +++ b/hai-service/src/main/java/com/hai/service/BsIntegralRebateService.java @@ -77,8 +77,24 @@ public interface BsIntegralRebateService { **/ void deleteIntegralRebate(Long id); + /** + * @Author Sum1Dream + * @Name integralRebate + * @Description // 订单积分返利 + * @Date 11:32 2022/9/1 + * @Param [object] + * @Return void + */ void integralRebate(JSONObject object); + /** + * @Author Sum1Dream + * @Name integralRechargeRebate + * @Description // 话费订单返利 + * @Date 11:33 2022/9/1 + * @Param [object] + * @Return void + */ void integralRechargeRebate(JSONObject object); } diff --git a/hai-service/src/main/java/com/hai/service/HighCouponService.java b/hai-service/src/main/java/com/hai/service/HighCouponService.java index 7f8860f2..30e00092 100644 --- a/hai-service/src/main/java/com/hai/service/HighCouponService.java +++ b/hai-service/src/main/java/com/hai/service/HighCouponService.java @@ -73,6 +73,16 @@ public interface HighCouponService { **/ void priceApproveResult(HighApprove highApprove); + /** + * @Author Sum1Dream + * @Name distributeApprove + * @Description // 卡券分发审批 + * @Date 16:57 2022/8/31 + * @Param [highApprove] + * @Return void + */ + void distributeApprove(HighApprove highApprove); + /** * @Author 胡锐 * @Description 根据id查询卡卷基本信息、赠送信息 @@ -105,6 +115,13 @@ public interface HighCouponService { **/ List getCouponList(Map map); + /** + * @Author 胡锐 + * @Description 获取卡卷集合 + * @Date 2021/3/15 23:12 + **/ + List getCouponListByAll(Map map); + /** * @Author 胡锐 * @Description 获取数量 diff --git a/hai-service/src/main/java/com/hai/service/impl/HighApproveServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighApproveServiceImpl.java index 2c2a8386..542d7fb3 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighApproveServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighApproveServiceImpl.java @@ -1,15 +1,16 @@ package com.hai.service.impl; +import com.alibaba.fastjson.JSONObject; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.dao.HighApproveMapper; -import com.hai.entity.HighApprove; -import com.hai.entity.HighApproveExample; -import com.hai.entity.HighCoupon; +import com.hai.entity.*; import com.hai.enum_type.ApproveType; import com.hai.model.HighCouponModel; +import com.hai.service.HighAgentService; import com.hai.service.HighApproveService; +import com.hai.service.HighCouponAgentService; import com.hai.service.HighCouponService; import org.apache.commons.collections4.MapUtils; import org.springframework.stereotype.Service; @@ -36,8 +37,9 @@ public class HighApproveServiceImpl implements HighApproveService { @Resource private HighCouponService highCouponService; + @Override - @Transactional(propagation= Propagation.REQUIRES_NEW) + @Transactional(propagation= Propagation.REQUIRES_NEW ,rollbackFor = Exception.class) public void insertApprove(HighApprove highApprove) { // 卡卷上架审批 @@ -49,6 +51,11 @@ public class HighApproveServiceImpl implements HighApproveService { if (Objects.equals(highApprove.getObjectType(), ApproveType.COUPON_PRICE_APPROVE.getType())) { // 暂时不需要调用接口 } + + // 卡卷分发审批 + if (Objects.equals(highApprove.getObjectType(), ApproveType.COUPON_DISTRIBUTE_APPROVE.getType())) { + // 暂时不需要调用接口 + } highApproveMapper.insert(highApprove); } @@ -64,14 +71,18 @@ public class HighApproveServiceImpl implements HighApproveService { @Override public void approveProcessed(HighApprove highApprove) { - if (highApprove.getObjectType() == ApproveType.UP_SHELF_APPROVE.getType()) { + if (highApprove.getObjectType().equals(ApproveType.UP_SHELF_APPROVE.getType())) { highCouponService.upShelfApproveResult(highApprove); } - if (highApprove.getObjectType() == ApproveType.COUPON_PRICE_APPROVE.getType()) { + if (highApprove.getObjectType().equals(ApproveType.COUPON_PRICE_APPROVE.getType())) { highCouponService.priceApproveResult(highApprove); } + if (highApprove.getObjectType().equals(ApproveType.COUPON_DISTRIBUTE_APPROVE.getType())) { + highCouponService.distributeApprove(highApprove); + } + updateApprove(highApprove); } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java index 37e49106..863eeaf8 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java @@ -71,7 +71,7 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService { private HighCouponCodeOtherService couponCodeOtherService; @Override - @Transactional(propagation= Propagation.REQUIRES_NEW) + @Transactional(propagation= Propagation.REQUIRES_NEW , rollbackFor = Exception.class) public void assignCouponAgent(HighCouponAgentRel highCouponAgentRel,Integer stockCount) { if (highCouponAgentRel.getId() != null) { highCouponAgentRelMapper.updateByPrimaryKey(highCouponAgentRel); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java index 3a3fdc35..86801db0 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java @@ -1,6 +1,7 @@ package com.hai.service.impl; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; @@ -33,6 +34,9 @@ public class HighCouponServiceImpl implements HighCouponService { @Resource private HighCouponMapper highCouponMapper; + @Resource + private HighCouponService highCouponService; + @Resource private HighCouponHandselService highCouponHandselService; @@ -51,6 +55,13 @@ public class HighCouponServiceImpl implements HighCouponService { @Resource private HighApproveService highApproveService; + + @Resource + private HighAgentService highAgentService; + + @Resource + private HighCouponAgentService highCouponAgentService; + @Override @Transactional(propagation= Propagation.REQUIRES_NEW) public void insertCoupon(HighCoupon highCouponModel) { @@ -279,6 +290,53 @@ public class HighCouponServiceImpl implements HighCouponService { highGoodsPriceReferService.updatePriceRefer(highGoodsPriceRefer); } + @Override + public void distributeApprove(HighApprove highApprove) { + JSONObject object = JSONObject.parseObject(highApprove.getApproveObject()); + + if (highApprove.getStatus() == 3) { + // 查询卡券详情 + HighCoupon coupon = highCouponService.getCouponById(object.getLong("couponId")); + if (coupon == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_COUPON, ""); + } + + // 查询代理商 + HighAgent highAgent = highAgentService.findByAgentMsgId(object.getLong("agentId")); + if (highAgent == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_AGENT, ""); + } + + // 校验是否分配过 + HighCouponAgentRel couponAgent = highCouponAgentService.getRelByCouponAgent(object.getLong("couponId"), object.getLong("agentId"), object.getInteger("type")); + if (couponAgent != null) { + couponAgent.setStockCount(couponAgent.getStockCount() + object.getInteger("stockCount")); + couponAgent.setOperatorId(highApprove.getSubmitOperatorId()); + couponAgent.setOperatorName(highApprove.getSubmitOperatorName()); + highCouponAgentService.assignCouponAgent(couponAgent,object.getInteger("stockCount")); + } else { + + HighCouponAgentRel highCouponAgentRel = new HighCouponAgentRel(); + + highCouponAgentRel.setCouponName(coupon.getCouponName()); + highCouponAgentRel.setSalesPrice(coupon.getSalesPrice()); + // 状态 0:删除 1:正常 + highCouponAgentRel.setStatus(1); + highCouponAgentRel.setSalesCount(0); + highCouponAgentRel.setType(object.getInteger("type")); + highCouponAgentRel.setCouponId(object.getLong("couponId")); + highCouponAgentRel.setAgentId(object.getLong("agentId")); + highCouponAgentRel.setStockCount(object.getInteger("stockCount")); + highCouponAgentRel.setCreateTime(new Date()); + highCouponAgentRel.setOperatorId(highApprove.getSubmitOperatorId()); + highCouponAgentRel.setOperatorName(highApprove.getSubmitOperatorName()); + highCouponAgentService.assignCouponAgent(highCouponAgentRel,highCouponAgentRel.getStockCount()); + } + } + + + } + @Override public HighCoupon getCouponById(Long id) { HighCoupon highCoupon = highCouponMapper.selectByPrimaryKey(id); @@ -390,6 +448,60 @@ public class HighCouponServiceImpl implements HighCouponService { return coupons; } + @Override + public List getCouponListByAll(Map map) { + HighCouponExample example = new HighCouponExample(); + HighCouponExample.Criteria criteria = example.createCriteria(); + + if (MapUtils.getLong(map, "companyId") != null) { + criteria.andCompanyIdEqualTo(MapUtils.getLong(map, "companyId")); + } + + if (MapUtils.getLong(map, "merchantId") != null) { + criteria.andMerchantIdEqualTo(MapUtils.getLong(map, "merchantId")); + } + + if (StringUtils.isNotBlank(MapUtils.getString(map, "couponName"))) { + criteria.andCouponNameLike("%" + MapUtils.getString(map, "couponName") + "%"); + } + + if (MapUtils.getInteger(map, "couponType") != null) { + criteria.andCouponTypeEqualTo(MapUtils.getInteger(map, "couponType")); + } + + if (MapUtils.getInteger(map, "displayArea") != null) { + criteria.andDisplayAreaEqualTo(MapUtils.getInteger(map, "displayArea")); + } + + if (MapUtils.getInteger(map, "displayArea") != null) { + criteria.andDisplayAreaEqualTo(MapUtils.getInteger(map, "displayArea")); + } + + if (MapUtils.getInteger(map, "brandId") != null) { + criteria.andBrandIdEqualTo(MapUtils.getInteger(map, "brandId")); + } + + if (MapUtils.getInteger(map, "goodsTypeId") != null) { + criteria.andGoodsTypeIdEqualTo(MapUtils.getInteger(map, "goodsTypeId")); + } + + if (MapUtils.getInteger(map, "status") != null) { + criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); + } + + if (MapUtils.getInteger(map, "couponSource") != null) { + criteria.andCouponSourceEqualTo(MapUtils.getInteger(map, "status")); + } + + if (MapUtils.getInteger(map, "notCouponSource") != null) { + criteria.andCouponSourceNotEqualTo(MapUtils.getInteger(map, "notCouponSource")); + } + + example.setOrderByClause("create_time"); + + return highCouponMapper.selectByExample(example); + } + @Override public Long getCouponByCouponName(Long companyId,String couponName) { HighCouponExample example = new HighCouponExample(); diff --git a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java index 83403cf9..f4fc3dd7 100644 --- a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java @@ -165,6 +165,19 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { DateUtil.format(MapUtils.getString(map, "createTimeS"), "yyyy-MM-dd HH:mm:ss"), DateUtil.format(MapUtils.getString(map, "createTimeE"), "yyyy-MM-dd HH:mm:ss")); } + if (MapUtils.getBoolean(map , "whetherTimeOut")) { + // 获取当前时间 + Date date= new Date(); + Calendar calendar = new GregorianCalendar(); + calendar.setTime(date); + // 把日期往前减少三天,整数 往后推,负数往前移动 + calendar.add(Calendar.DATE, -3); + // 这个时间就是日期往后推一天的结果 + date = calendar.getTime(); + criteria.andCreateTimedLessThan(date); + + } + example.setOrderByClause("create_timed desc"); return outRechargeOrderMapper.selectByExample(example); diff --git a/v1/src/main/java/com/v1/config/AuthConfig.java b/v1/src/main/java/com/v1/config/AuthConfig.java index 208a9421..d85e96cd 100644 --- a/v1/src/main/java/com/v1/config/AuthConfig.java +++ b/v1/src/main/java/com/v1/config/AuthConfig.java @@ -95,6 +95,7 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/thirdParty/*") .excludePathPatterns("/selfOilStation/*") .excludePathPatterns("/order/*") + .excludePathPatterns("/wxMsg/*") ; } diff --git a/v1/src/main/java/com/v1/config/SysConfig.java b/v1/src/main/java/com/v1/config/SysConfig.java index 47b1abec..2a69f41b 100644 --- a/v1/src/main/java/com/v1/config/SysConfig.java +++ b/v1/src/main/java/com/v1/config/SysConfig.java @@ -9,5 +9,22 @@ import org.springframework.stereotype.Component; @PropertySource("classpath:/config.properties") public class SysConfig { + private String wxH5AppId; + private String wxH5AppSecret; + public String getWxH5AppId() { + return wxH5AppId; + } + + public void setWxH5AppId(String wxH5AppId) { + this.wxH5AppId = wxH5AppId; + } + + public String getWxH5AppSecret() { + return wxH5AppSecret; + } + + public void setWxH5AppSecret(String wxH5AppSecret) { + this.wxH5AppSecret = wxH5AppSecret; + } } diff --git a/v1/src/main/java/com/v1/controller/WxMsgController.java b/v1/src/main/java/com/v1/controller/WxMsgController.java new file mode 100644 index 00000000..1dd3adc2 --- /dev/null +++ b/v1/src/main/java/com/v1/controller/WxMsgController.java @@ -0,0 +1,92 @@ +package com.v1.controller; + +import com.alibaba.fastjson.JSONObject; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; +import com.hai.common.utils.HttpsUtils; +import com.hai.common.utils.ResponseMsgUtil; +import com.hai.common.utils.WxUtils; +import com.hai.model.ResponseData; +import com.v1.config.SysConst; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import me.chanjar.weixin.common.util.crypto.SHA1; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.Map; + +/** + * @author sum1dream + */ + +@Controller +@RequestMapping(value = "/wxMsg") +@Api(value = "自建站接口") +public class WxMsgController { + + private static Logger log = LoggerFactory.getLogger(ThirdPartyController.class); + + @RequestMapping(value = "/verifyWxToken", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "验证servlet") + public String verifyWxToken(HttpServletRequest request) { + + try { + log.info("进入验证servlet!!!!!"); + log.info(String.valueOf(request)); + String msgSignature = request.getParameter("signature"); + String msgTimestamp = request.getParameter("timestamp"); + String msgNonce = request.getParameter("nonce"); + String echoStr = request.getParameter("echoStr"); + + + Map params = new HashMap<>(); + params.put("timestamp", msgTimestamp); + params.put("nonce", msgNonce); + String signatureStr = WxUtils.generateSignature(params); + String sign = SHA1.gen(signatureStr); + + if (msgSignature.equals(sign)) { + log.info("验证通过!!!!!"); + return echoStr; + } + log.info("验证失败!!!!!"); + return null; + } catch (Exception e) { + return null; + } + + } + + @RequestMapping(value = "/getWxToken", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "获取微信token") + public ResponseData getWxToken() { + try { + Map params = new HashMap<>(); + params.put("appid", SysConst.getSysConfig().getWxH5AppId()); + params.put("secret", SysConst.getSysConfig().getWxH5AppSecret()); + params.put("grant_type", "client_credential"); + + JSONObject accessTokenObject = HttpsUtils.doGet("https://api.weixin.qq.com/cgi-bin/token", params); + if (accessTokenObject == null) { + log.error("getH5UserInfo error!", "获取微信access_token失败" ); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取微信access_token失败"); + } + + return ResponseMsgUtil.success(accessTokenObject); + + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } + +} diff --git a/v1/src/main/resources/dev/config.properties b/v1/src/main/resources/dev/config.properties index e69de29b..a85b033e 100644 --- a/v1/src/main/resources/dev/config.properties +++ b/v1/src/main/resources/dev/config.properties @@ -0,0 +1,2 @@ +wxH5AppId=wxb05f4cb44994a960 +wxH5AppSecret=68b540ebce7a4020420f4e5997b1531b diff --git a/v1/src/main/resources/dev/logback.xml b/v1/src/main/resources/dev/logback.xml index a7602e3d..eb31bd4d 100644 --- a/v1/src/main/resources/dev/logback.xml +++ b/v1/src/main/resources/dev/logback.xml @@ -63,6 +63,9 @@ + + + From 7dc749ffd0ea5a6843607b696c9d6db877b4c79a Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Fri, 2 Sep 2022 14:24:11 +0800 Subject: [PATCH 14/24] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E5=85=AC=E5=8F=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/hai/schedule/HighOrderSchedule.java | 4 ++-- hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java | 2 +- .../src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java index 0a12ccd4..08175d5b 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java @@ -439,7 +439,7 @@ public class HighOrderSchedule { * @Param [] * @return void */ - @Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次 + @Scheduled(cron="0 0/5 * * * ?") //每1分钟执行一次 public void integralRebateOrder() { List order = highOrderService.integralRebateOrder(); for (HighOrder highOrder : order) { @@ -477,7 +477,7 @@ public class HighOrderSchedule { * @Param [] * @return void */ - @Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次 + @Scheduled(cron="0 0/5 * * * ?") //每1分钟执行一次 public void integralRebateRechargeOrder() { List order = outRechargeOrderService.integralRebateRechargeOrder(); for (OutRechargeOrder outRechargeOrder : order) { diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java index 1854ffa4..322a4b6c 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java @@ -1250,7 +1250,7 @@ public interface HighOrderMapperExt { }) List getSelfOilStationOrderList(@Param("goodsId") String goodsId); - @Select("select * from high_order where order_status = 3 and pay_type != 3 and pay_real_price > 0 and whether_rebate = false ") + @Select("select * from high_order where order_status = 3 and pay_type != 3 and pay_real_price > 0 and whether_rebate = false group by create_time desc;") @Results({ @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR), diff --git a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java index cc0f628a..bed63e07 100644 --- a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java @@ -147,7 +147,7 @@ public interface OutRechargeOrderMapperExt { }) OrderCountModel rechargeOrderByIndex(Integer code); - @Select("select * from out_recharge_order where recharge_status = 202 and pay_status = 100 and pay_type != 3 and pay_real_price > 0 and whether_rebate = false ") + @Select("select * from out_recharge_order where recharge_status = 202 and pay_status = 100 and pay_type != 3 and pay_real_price > 0 and whether_rebate = false group by create_timed desc ; ") @Results({ @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="recharge_price", property="rechargePrice", jdbcType=JdbcType.DECIMAL), From aa1e245f0b48b83d0d75783ae04b8d71655bbb59 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Fri, 2 Sep 2022 16:27:38 +0800 Subject: [PATCH 15/24] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hai/schedule/HighCouponSchedule.java | 61 ++++++++++--------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java index a2d71a6b..d7cb08b9 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java @@ -84,41 +84,42 @@ public class HighCouponSchedule { if (jsonObject.getString("respCode").equals("0000")) { JSONObject data = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data")); - - if (data.getString("respCode").equals("0000") && data.getJSONObject("data").getInteger("state") != 20) { - couponCodeOther.setStatus(data.getJSONObject("data").getInteger("state")); - highCouponCodeOtherMapper.updateByPrimaryKey(couponCodeOther); - - if (couponCodeOther.getCouponAgentCodeId() != null) { - HighCouponAgentCode agentCode = highCouponAgentCodeMapper.selectByPrimaryKey(couponCodeOther.getCouponAgentCodeId()); - if (agentCode == null) { - agentCode.setStatus(3); - highCouponAgentCodeMapper.updateByPrimaryKey(agentCode); + if (data.getString("respCode").equals("0000")) { + JSONObject responseObject = JSONObject.parseObject(data.getString("data")); + if (responseObject.getInteger("state") != 20) { + couponCodeOther.setStatus(responseObject.getInteger("state")); + highCouponCodeOtherMapper.updateByPrimaryKey(couponCodeOther); + + if (couponCodeOther.getCouponAgentCodeId() != null) { + HighCouponAgentCode agentCode = highCouponAgentCodeMapper.selectByPrimaryKey(couponCodeOther.getCouponAgentCodeId()); + if (agentCode == null) { + agentCode.setStatus(3); + highCouponAgentCodeMapper.updateByPrimaryKey(agentCode); + } } - } - if (couponCodeOther.getChildOrderId() != null) { - HighUserCouponExample userCouponExample = new HighUserCouponExample(); - userCouponExample.createCriteria().andQrCodeImgEqualTo(couponCodeOther.getCouNo()).andStatusEqualTo(1); - List list = highUserCouponMapper.selectByExample(userCouponExample); - if (list.size() > 0) { - HighUserCoupon userCoupon = list.get(0); - if (data.getJSONObject("data").getInteger("state") == 40) { - userCoupon.setStatus(2); - userCoupon.setConsumeTime(new Date()); - } else { - userCoupon.setStatus(0); + if (couponCodeOther.getChildOrderId() != null) { + HighUserCouponExample userCouponExample = new HighUserCouponExample(); + userCouponExample.createCriteria().andQrCodeImgEqualTo(couponCodeOther.getCouNo()).andStatusEqualTo(1); + List list = highUserCouponMapper.selectByExample(userCouponExample); + if (list.size() > 0) { + HighUserCoupon userCoupon = list.get(0); + if (responseObject.getInteger("state") == 40) { + userCoupon.setStatus(2); + userCoupon.setConsumeTime(new Date()); + } else { + userCoupon.setStatus(0); + } + highUserCouponMapper.updateByPrimaryKey(userCoupon); + } + // 查询订单中的汇联通卡券全部已处理 + HighCouponCodeOtherExample otherExample = new HighCouponCodeOtherExample(); + otherExample.createCriteria().andChildOrderIdEqualTo(couponCodeOther.getChildOrderId()).andStatusEqualTo(20).andTypeEqualTo(1); + if (highCouponCodeOtherMapper.selectByExample(otherExample).size() == 0) { + highOrderService.childOrderComplete(couponCodeOther.getChildOrderId()); } - highUserCouponMapper.updateByPrimaryKey(userCoupon); - } - // 查询订单中的汇联通卡券全部已处理 - HighCouponCodeOtherExample otherExample = new HighCouponCodeOtherExample(); - otherExample.createCriteria().andChildOrderIdEqualTo(couponCodeOther.getChildOrderId()).andStatusEqualTo(20).andTypeEqualTo(1); - if (highCouponCodeOtherMapper.selectByExample(otherExample).size() == 0) { - highOrderService.childOrderComplete(couponCodeOther.getChildOrderId()); } } - } } } From 2d8fdf4ee2491a4db5c1fa3acb70931c2a814658 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Fri, 2 Sep 2022 18:05:17 +0800 Subject: [PATCH 16/24] 1 --- .../cweb/controller/HighUserController.java | 2 +- .../java/com/hai/common/utils/WxUtils.java | 52 ++++++-- .../java/com/hai/service/CommonService.java | 3 + .../hai/service/impl/CommonServiceImpl.java | 5 +- .../java/com/v1/config/WeChatQrcodeUtils.java | 121 ++++++++++++++++++ v1/src/main/java/com/v1/config/WxConfig.java | 51 ++++++++ .../com/v1/controller/WxMsgController.java | 90 ++++++++++--- v1/src/main/resources/dev/config.properties | 4 +- 8 files changed, 294 insertions(+), 34 deletions(-) create mode 100644 v1/src/main/java/com/v1/config/WeChatQrcodeUtils.java create mode 100644 v1/src/main/java/com/v1/config/WxConfig.java diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java b/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java index 6a0fa5ae..7691bfef 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java @@ -148,7 +148,7 @@ public class HighUserController { if (StringUtils.isBlank(body.getString("password")) || body.getString("password").length() != 6){ log.error("HighUserController --> setUserPayPwd() error!", "请设置6位支付密码"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请设置6支付密码"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请设置6位支付密码"); } // 查询用户密码 diff --git a/hai-service/src/main/java/com/hai/common/utils/WxUtils.java b/hai-service/src/main/java/com/hai/common/utils/WxUtils.java index 6aac9c4c..874dcae7 100644 --- a/hai-service/src/main/java/com/hai/common/utils/WxUtils.java +++ b/hai-service/src/main/java/com/hai/common/utils/WxUtils.java @@ -7,25 +7,21 @@ import com.hai.common.pay.util.sdk.WXPayXmlUtil; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.io.naming.NoNameCoder; import com.thoughtworks.xstream.io.xml.XppDriver; + import net.sf.cglib.beans.BeanMap; import org.apache.commons.lang3.StringUtils; -import org.apache.http.conn.ssl.SSLConnectionSocketFactory; -import org.apache.http.conn.ssl.SSLContexts; + import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSocket; -import javax.net.ssl.SSLSocketFactory; + import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import java.io.File; -import java.io.FileInputStream; + import java.io.StringWriter; -import java.security.KeyStore; import java.security.MessageDigest; import java.security.SecureRandom; import java.util.*; @@ -504,4 +500,44 @@ public class WxUtils { } } + /** + * 用SHA1算法生成安全签名 + * @param token 票据 + * @param timestamp 时间戳 + * @param nonce 随机字符串 + * @return 安全签名 + * @throws Exception + */ + public static String getSHA1(String token, String timestamp, String nonce) throws Exception + { + try { + String[] array = new String[] { token, timestamp, nonce}; + StringBuffer sb = new StringBuffer(); + // 字符串排序 + Arrays.sort(array); + for (int i = 0; i < 3; i++) { + sb.append(array[i]); + } + String str = sb.toString(); + // SHA1签名生成 + MessageDigest md = MessageDigest.getInstance("SHA-1"); + md.update(str.getBytes()); + byte[] digest = md.digest(); + + StringBuffer hexstr = new StringBuffer(); + String shaHex = ""; + for (int i = 0; i < digest.length; i++) { + shaHex = Integer.toHexString(digest[i] & 0xFF); + if (shaHex.length() < 2) { + hexstr.append(0); + } + hexstr.append(shaHex); + } + return hexstr.toString(); + } catch (Exception e) { + e.printStackTrace(); + throw new Exception(String.format("Invalid sign_type: %s")); + } + } + } diff --git a/hai-service/src/main/java/com/hai/service/CommonService.java b/hai-service/src/main/java/com/hai/service/CommonService.java index e79dfd4a..a2ed2a4d 100644 --- a/hai-service/src/main/java/com/hai/service/CommonService.java +++ b/hai-service/src/main/java/com/hai/service/CommonService.java @@ -15,6 +15,8 @@ import com.hai.model.IndexCountModel; import com.hai.model.LineCountModel; import com.hai.model.OrderCountModel; import com.hai.model.OrderSumModel; +import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket; import org.apache.ibatis.type.BigDecimalTypeHandler; import java.math.BigDecimal; @@ -293,4 +295,5 @@ public interface CommonService { */ ApiCity findCityByName(String name); + } diff --git a/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java index 25e37784..6ff7a0ed 100644 --- a/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java @@ -17,7 +17,9 @@ import com.hai.service.CommonService; import com.hai.service.HighOrderService; import com.hai.service.HighUserService; import com.hai.service.SecConfigService; + import org.apache.commons.lang3.StringUtils; + import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; @@ -40,7 +42,7 @@ public class CommonServiceImpl implements CommonService { private long lastReadTime = 0; private long regionLastReadTime = 0; - + @Resource private SecRegionMapper regionMapper; @@ -694,5 +696,4 @@ public class CommonServiceImpl implements CommonService { } - } diff --git a/v1/src/main/java/com/v1/config/WeChatQrcodeUtils.java b/v1/src/main/java/com/v1/config/WeChatQrcodeUtils.java new file mode 100644 index 00000000..ced8374d --- /dev/null +++ b/v1/src/main/java/com/v1/config/WeChatQrcodeUtils.java @@ -0,0 +1,121 @@ +package com.v1.config; + + +import lombok.extern.slf4j.Slf4j; +import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.mp.api.WxMpService; +import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.File; + +/** + * @serviceName WeChatQrcodeUtils.java + * @author Sum1Dream + * @version 1.0.0 + * @Description // 生成带参数的二维码 + * @createTime 16:11 2022/9/2 + **/ +@Slf4j +@Component +public class WeChatQrcodeUtils { + + @Autowired + private WxMpService wxMpService; + + /** + *
+     * 创建临时二维码ticket
+     * @param sceneId       场景值ID,临时二维码时为32位非0整型
+     * @param expireSeconds 该二维码有效时间,以秒为单位。 最大不超过2592000(即30天),此字段如果不填,则默认有效期为30秒。
+     * @auther: cao_wencao
+     * @date: 2019/2/18 16:58
+     * 
+ */ + public WxMpQrCodeTicket qrCodeCreateTmpTicket(int sceneId, Integer expireSeconds) throws WxErrorException { + WxMpQrCodeTicket wxMpQrCodeTicket = wxMpService.getQrcodeService().qrCodeCreateTmpTicket(sceneId, expireSeconds); + return wxMpQrCodeTicket; + } + + /** + *
+     * 创建临时二维码ticket
+     * @param sceneStr      场景值ID(字符串形式的ID),字符串类型,长度限制为1到64
+     * @param expireSeconds 该二维码有效时间,以秒为单位。 最大不超过2592000(即30天),此字段如果不填,则默认有效期为30秒。
+     * @auther: cao_wencao
+     * @date: 2019/2/18 17:01
+     * 
+ */ + public WxMpQrCodeTicket qrCodeCreateTmpTicket(String sceneStr, Integer expireSeconds) throws WxErrorException { + WxMpQrCodeTicket wxMpQrCodeTicket = wxMpService.getQrcodeService().qrCodeCreateTmpTicket(sceneStr, expireSeconds); + return wxMpQrCodeTicket; + } + + /** + *
+     * 创建永久二维码ticket
+     * @param sceneId 场景值ID,最大值为100000(目前参数只支持1--100000)
+     * @auther: cao_wencao
+     * @date: 2019/2/18 17:03
+     * 
+ */ + public WxMpQrCodeTicket qrCodeCreateLastTicket(int sceneId) throws WxErrorException { + return wxMpService.getQrcodeService().qrCodeCreateLastTicket(sceneId); + } + + /** + *
+     * 创建永久字符串二维码ticket
+     * @param sceneStr 参数。字符串类型长度现在为1到64
+     * @auther: cao_wencao
+     * @date: 2019/2/18 17:05
+     * 
+ */ + public WxMpQrCodeTicket qrCodeCreateLastTicket(String sceneStr) throws WxErrorException { + return wxMpService.getQrcodeService().qrCodeCreateLastTicket(sceneStr); + } + + /** + *
+     * 换取二维码图片文件,jpg格式
+     * @param ticket 二维码ticket
+     * @auther: cao_wencao
+     * @date: 2019/2/18 17:07
+     * 
+ */ + public File qrCodePicture(WxMpQrCodeTicket ticket) throws WxErrorException { + return wxMpService.getQrcodeService().qrCodePicture(ticket); + + } + + /** + *
+     * 换取二维码图片url地址(可以选择是否生成压缩的网址)
+     * @param ticket       二维码ticket
+     * @param needShortUrl 是否需要压缩的二维码地址
+     * @auther: cao_wencao
+     * @date: 2019/2/18 17:10
+     * 
+ */ + public String qrCodePictureUrl(String ticket, boolean needShortUrl) throws WxErrorException { + String qrCodeUrl = wxMpService.getQrcodeService().qrCodePictureUrl(ticket, needShortUrl); + return qrCodeUrl; + } + + /** + *
+     * 换取二维码图片url地址
+     * @param ticket 二维码ticket
+     * @auther: cao_wencao
+     * @date: 2019/2/18 17:11
+     * 
+ */ + public String qrCodePictureUrl(String ticket) throws WxErrorException { + String url = wxMpService.getQrcodeService().qrCodePictureUrl(ticket); + return url; + } + + +} diff --git a/v1/src/main/java/com/v1/config/WxConfig.java b/v1/src/main/java/com/v1/config/WxConfig.java new file mode 100644 index 00000000..286afac7 --- /dev/null +++ b/v1/src/main/java/com/v1/config/WxConfig.java @@ -0,0 +1,51 @@ +package com.v1.config; + +import com.hai.config.CommonSysConst; +import me.chanjar.weixin.mp.api.WxMpService; +import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; +import me.chanjar.weixin.mp.config.WxMpConfigStorage; +import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @serviceName .java + * @author Sum1Dream + * @version 1.0.0 + * @Description //TODO + * @createTime 16:24 2022/9/2 + **/ +@Configuration +public class WxConfig { + + + /** + * 微信客户端配置存储 + * + * @return + */ + @Bean + public WxMpConfigStorage wxMpConfigStorage() { + WxMpDefaultConfigImpl configStorage = new WxMpDefaultConfigImpl(); + // 公众号appId + configStorage.setAppId(SysConst.getSysConfig().getWxH5AppId()); + // 公众号appSecret + configStorage.setSecret(SysConst.getSysConfig().getWxH5AppSecret()); + return configStorage; + } + + /** + * @Author Sum1Dream + * @Name wxMpService + * @Description //TODO + * @Date 16:24 2022/9/2 + * @Param [] + * @Return WxMpService + */ + @Bean + public WxMpService wxMpService() { + WxMpService wxMpService = new WxMpServiceImpl(); + wxMpService.setWxMpConfigStorage(wxMpConfigStorage()); + return wxMpService; + } +} diff --git a/v1/src/main/java/com/v1/controller/WxMsgController.java b/v1/src/main/java/com/v1/controller/WxMsgController.java index 1dd3adc2..12e0928d 100644 --- a/v1/src/main/java/com/v1/controller/WxMsgController.java +++ b/v1/src/main/java/com/v1/controller/WxMsgController.java @@ -4,24 +4,35 @@ import com.alibaba.fastjson.JSONObject; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; +import com.hai.common.pay.util.IOUtil; +import com.hai.common.pay.util.XmlUtil; import com.hai.common.utils.HttpsUtils; import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.WxUtils; import com.hai.model.ResponseData; +import com.hai.service.CommonService; import com.v1.config.SysConst; +import com.v1.config.WeChatQrcodeUtils; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import me.chanjar.weixin.common.util.crypto.SHA1; + +import me.chanjar.weixin.common.error.WxErrorException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; + +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; +import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; + import java.util.HashMap; import java.util.Map; +import java.util.SortedMap; /** * @author sum1dream @@ -34,31 +45,30 @@ public class WxMsgController { private static Logger log = LoggerFactory.getLogger(ThirdPartyController.class); - @RequestMapping(value = "/verifyWxToken", method = RequestMethod.POST) + @Autowired + private WeChatQrcodeUtils weChatQrcodeUtils; + + + + @RequestMapping(value = "/verifyWxToken", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "验证servlet") public String verifyWxToken(HttpServletRequest request) { try { - log.info("进入验证servlet!!!!!"); - log.info(String.valueOf(request)); - String msgSignature = request.getParameter("signature"); - String msgTimestamp = request.getParameter("timestamp"); - String msgNonce = request.getParameter("nonce"); - String echoStr = request.getParameter("echoStr"); - - - Map params = new HashMap<>(); - params.put("timestamp", msgTimestamp); - params.put("nonce", msgNonce); - String signatureStr = WxUtils.generateSignature(params); - String sign = SHA1.gen(signatureStr); - - if (msgSignature.equals(sign)) { - log.info("验证通过!!!!!"); - return echoStr; - } - log.info("验证失败!!!!!"); + log.info("进入公众号!!!!!!!"); + // 反馈给微信服务器 + String resXml = ""; + // 微信支付系统发送的数据(格式) + String notifyXml; + notifyXml = IOUtil.inputStreamToString(request.getInputStream(), "UTF-8"); + + log.info("微信支付系统发送的数据:" + notifyXml); + SortedMap map = XmlUtil.parseXmlToTreeMap(notifyXml, "UTF-8"); + + // 区分消息类型 + String msgType = map.get("MsgType"); + log.info("微信支付系统发送的数据:" + msgType); return null; } catch (Exception e) { return null; @@ -89,4 +99,42 @@ public class WxMsgController { } } + /** + *
+     * @desc: 创建生成二维码
+     * @auth: cao_wencao
+     * @date: 2019/4/10 14:00
+     * 
+ */ + + @RequestMapping(value = "/createQrcode", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "创建生成二维码") + public ResponseData createQrcode(@RequestParam(name = "sceneId", required = false) Integer sceneId) { + try { + return ResponseMsgUtil.success(weChatQrcodeUtils.qrCodeCreateLastTicket(sceneId)); + } catch (WxErrorException e) { + return ResponseMsgUtil.exception(e); + } + } + + /** + *
+     * @desc: 通过ticket获取二维码(长链接URL)
+     * @auth: cao_wencao
+     * @date: 2019/4/10 14:00
+     * 
+ */ + @RequestMapping(value = "/getQrcodeUrl", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "创建生成二维码") + public ResponseData getQrcodeUrl(@RequestParam(name = "ticket", required = false) String ticket) { + try { + return ResponseMsgUtil.success(weChatQrcodeUtils.qrCodePictureUrl(ticket)); + } catch (WxErrorException e) { + return ResponseMsgUtil.exception(e); + } + } + + } diff --git a/v1/src/main/resources/dev/config.properties b/v1/src/main/resources/dev/config.properties index a85b033e..b7bbc8e8 100644 --- a/v1/src/main/resources/dev/config.properties +++ b/v1/src/main/resources/dev/config.properties @@ -1,2 +1,2 @@ -wxH5AppId=wxb05f4cb44994a960 -wxH5AppSecret=68b540ebce7a4020420f4e5997b1531b +wxH5AppId=wxa075e8509802f826 +wxH5AppSecret=0e606fc1378d35e359fcf3f15570b2c5 From 8ad7fe2a17abe1282828651a3a70050fc1003700 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Mon, 5 Sep 2022 18:01:08 +0800 Subject: [PATCH 17/24] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/hai/schedule/HighTestController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighTestController.java b/hai-schedule/src/main/java/com/hai/schedule/HighTestController.java index ca98a608..8cb6e933 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighTestController.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighTestController.java @@ -1 +1 @@ -package com.hai.schedule; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.XmlUtil; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.WxUtils; import com.hai.config.*; import com.hai.dao.HighGasOrderPushMapper; import com.hai.entity.*; import com.hai.model.HighMerchantModel; import com.hai.model.HighMerchantStoreModel; import com.hai.model.ResponseData; import com.hai.model.ResultProfitSharing; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContexts; import org.apache.http.util.EntityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import javax.net.ssl.SSLContext; import java.io.FileInputStream; import java.math.BigDecimal; import java.security.KeyStore; import java.util.*; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private HighMerchantService highMerchantService; @Resource private HighMerchantStoreService highMerchantStoreService; @Resource private HighGasOilPriceService highGasOilPriceService; @Resource private HighOrderService highOrderService; @Resource private HighProfitSharingRecordService highProfitSharingRecordService; @Resource private HighGasOrderPushMapper highGasOrderPushMapper; @Resource private HuiLianTongConfig huiLianTongConfig; @Resource private UnionPayConfig unionPayConfig; @RequestMapping(value = "/getToken", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取贵州中石化token") public ResponseData getToken() { try { return ResponseMsgUtil.success(huiLianTongConfig.getToken()); } catch (Exception e) { log.error("HighOrderController --> getToken() error!", e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file +package com.hai.schedule; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.XmlUtil; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.utils.DateUtil; import com.hai.common.utils.HttpsUtils; import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.WxUtils; import com.hai.config.*; import com.hai.dao.HighGasOrderPushMapper; import com.hai.entity.*; import com.hai.model.HighMerchantModel; import com.hai.model.HighMerchantStoreModel; import com.hai.model.ResponseData; import com.hai.model.ResultProfitSharing; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContexts; import org.apache.http.util.EntityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import javax.net.ssl.SSLContext; import javax.servlet.http.HttpServletRequest; import java.io.FileInputStream; import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.security.KeyStore; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.*; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private HighMerchantService highMerchantService; @Resource private HighMerchantStoreService highMerchantStoreService; @Resource private HighGasOilPriceService highGasOilPriceService; @Resource private HighOrderService highOrderService; @Resource private HighProfitSharingRecordService highProfitSharingRecordService; @Resource private HighGasOrderPushMapper highGasOrderPushMapper; @Resource private HuiLianTongConfig huiLianTongConfig; @Resource private UnionPayConfig unionPayConfig; @Resource private SecSinopecConfigService secSinopecConfigService; @Resource private HighCouponCodeService highCouponCodeService; @RequestMapping(value = "/synchronizeCNPC", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "同步重庆中石化") public ResponseData synchronizeCNPC(HttpServletRequest request) { List sinopecConfigList = secSinopecConfigService.getListSinopecConfig(new HashMap<>()); for (SecSinopecConfig config : sinopecConfigList) { try { String token = getCnpcToken(config.getAppId(), config.getAppSecret()); if (token != null) { Calendar instance = Calendar.getInstance(); instance.set(Calendar.YEAR, 2021); instance.set(Calendar.MONTH, 9); instance.set(Calendar.DATE, 1); instance.set(Calendar.MINUTE, 00); instance.set(Calendar.SECOND, 00); instance.set(Calendar.MILLISECOND, 00); Map bodyMap = new HashMap<>(); bodyMap.put("appId", config.getAppId()); bodyMap.put("pageNo", 1); bodyMap.put("pageSize", 1000); bodyMap.put("startTime", instance.getTime()); bodyMap.put("endTime", new Date()); bodyMap.put("customerCode", config.getCode()); Long date = new Date().getTime(); String sha256 = encodeBySHA256(config.getSignkey() + JSON.toJSONString(bodyMap) + date); JSONObject object = HttpsUtils.doPost("https://app.zshcqsy.com/api-provider/sapapi/open/coupon/customerRedeemcodeList", JSON.toJSONString(bodyMap), token, sha256, date); if(Objects.equals(object.get("success"), true)) { Object dataJson = JSONObject.parse(JSONObject.toJSONString(object.get("data"))); JSONObject dataObject = JSON.parseObject(JSONObject.toJSONString(dataJson)); // 总页数 int rowPageCount = new BigDecimal(dataObject.getString("rowCount")).divide(new BigDecimal("100"), 0, BigDecimal.ROUND_UP).intValue(); for (int i = 1; i < rowPageCount;i++) { token = getCnpcToken(config.getAppId(), config.getAppSecret()); bodyMap.clear(); bodyMap.put("appId", config.getAppId()); bodyMap.put("pageNo", i); bodyMap.put("pageSize", 1000); bodyMap.put("startTime", instance.getTime()); bodyMap.put("endTime", new Date()); bodyMap.put("customerCode", config.getCode()); Long date2 = new Date().getTime(); sha256 = encodeBySHA256(config.getSignkey() + JSON.toJSONString(bodyMap) + date); object = HttpsUtils.doPost("https://app.zshcqsy.com/api-provider/sapapi/open/coupon/customerRedeemcodeList", JSON.toJSONString(bodyMap), token, sha256, date); if (Objects.equals(object.get("success"), true)) { dataJson = JSONObject.parse(JSONObject.toJSONString(object.get("data"))); dataObject = JSON.parseObject(JSONObject.toJSONString(dataJson)); JSONArray list = dataObject.getJSONArray("list"); for (Object dataJsonObject : list) { try { JSONObject parseObject = JSON.parseObject(JSON.toJSONString(dataJsonObject)); String codeId = parseObject.getString("codeId"); String nodeName = parseObject.getString("nodeName"); Date useTime = DateUtil.format(parseObject.getString("useTime"), "yyyy-MM-dd HH:mm:ss"); highCouponCodeService.cnpcCallbackCouponCode(codeId, useTime, nodeName); } catch (Exception e) { log.error("HighCouponSchedule --> expiredCoupon() error!", e); } } } } } } } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } return ResponseMsgUtil.success(null); } private String getCnpcToken(String appId,String appSecret) { Map tokenMap = new HashMap<>(); tokenMap.put("appId", appId); tokenMap.put("appSecret", appSecret); JSONObject jsonObject = HttpsUtils.doPost("https://app.zshcqsy.com/api-provider/api/open/merchant/token", JSON.toJSONString(tokenMap)); log.error(jsonObject.toJSONString()); if (jsonObject != null && jsonObject.getBoolean("success") == true) { JSONObject data = jsonObject.getJSONObject("data"); String token = data.getString("token"); return token; } return null; } public String encodeBySHA256(String str) { try{ MessageDigest messageDigest = MessageDigest.getInstance("SHA-256"); messageDigest.reset(); messageDigest.update(str.getBytes("UTF-8")); return getFormattedText(messageDigest.digest()); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (Exception e) { throw new RuntimeException(e); } return ""; } private static final String[] HEX_DIGITS = {"0" ,"1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"}; private String getFormattedText(byte[] bytes) { int len = bytes.length; StringBuilder buf = new StringBuilder(len * 2); // 把密文转换成十六进制的字符串形式 for (int j=0;j> 4) & 0x0f]); buf.append(HEX_DIGITS[bytes[j] & 0x0f]); } return buf.toString(); } } \ No newline at end of file From e94eb37170a9ce05b108565d1ef80c0d17fe91fb Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Fri, 9 Sep 2022 17:40:45 +0800 Subject: [PATCH 18/24] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/cweb/controller/HighGasController.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java b/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java index 35e62039..3aa4155b 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java @@ -126,8 +126,9 @@ public class HighGasController { for (Map map : mapPageInfo.getList()) { if (StringUtils.isNotBlank(MapUtils.getString(map, "oil_no"))) { - - if (MapUtils.getInteger(map, "source_type").equals(1)) { + if (MapUtils.getInteger(map, "source_type").equals(1) + || MapUtils.getInteger(map, "source_type").equals(3) + || MapUtils.getInteger(map, "source_type").equals(4)) { // 查询是否配置了【油站的】优惠比例 HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, MapUtils.getLong(map, "id"), MapUtils.getString(map, "oil_no")); if (tyAgentPrice != null) { From 523fbe114e752b2f647e1295ee521fe6e3bb52ad Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Wed, 14 Sep 2022 14:34:51 +0800 Subject: [PATCH 19/24] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E5=85=AC=E5=8F=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/bweb/controller/HighDiscountPackageController.java | 6 +++--- .../java/com/cweb/controller/HighThirdPartyController.java | 2 -- .../src/main/java/com/hai/config/UnionUserConfig.java | 1 + .../java/com/hai/service/impl/HighOrderServiceImpl.java | 4 +--- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java index ded4edef..325deb77 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java @@ -164,9 +164,9 @@ public class HighDiscountPackageController { if (StringUtils.isBlank(highDiscountPackage.getTitle()) || highDiscountPackage.getSalesType() == null -// || StringUtils.isBlank(highDiscountPackage.getBannerImg()) -// || StringUtils.isBlank(highDiscountPackage.getListImg()) -// || StringUtils.isBlank(highDiscountPackage.getDetailsImg()) + || StringUtils.isBlank(highDiscountPackage.getBannerImg()) + || StringUtils.isBlank(highDiscountPackage.getListImg()) + || StringUtils.isBlank(highDiscountPackage.getDetailsImg()) ) { log.error("HighAgentController -> insertCouponPackageInfo() error!","参数错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java b/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java index 1422f099..7b4d55bc 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java @@ -308,8 +308,6 @@ public class HighThirdPartyController { SessionObject sessionObject = userCenter.getSessionObject(request); HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); - System.out.println("======================================================" + object); - if (StringUtils.isBlank(object.getString("customerMobile")) || StringUtils.isBlank(object.getString("regionId")) || object.getInteger("productType") == null || diff --git a/hai-service/src/main/java/com/hai/config/UnionUserConfig.java b/hai-service/src/main/java/com/hai/config/UnionUserConfig.java index 8a17cd52..07d651b2 100644 --- a/hai-service/src/main/java/com/hai/config/UnionUserConfig.java +++ b/hai-service/src/main/java/com/hai/config/UnionUserConfig.java @@ -50,6 +50,7 @@ public class UnionUserConfig { paramMap.remove("secret"); JSONObject jsonObject = JSONObject.parseObject(UnionUtils.sendPostGson(requestUrl+"backendToken", paramMap)); String backendToken = jsonObject.getJSONObject("params").getString("backendToken"); + System.out.println(jsonObject + "================================================="); redisUtil.set("UNION_BACKEND_TOKEN", backendToken,jsonObject.getJSONObject("params").getLong("expiresIn")); return backendToken; } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index ad812c72..18b9bfc6 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -2262,8 +2262,6 @@ public class HighOrderServiceImpl implements HighOrderService { // 1 星巴克 2 肯德基 3 会员充值 if (object.getInteger("productType") == 1) { - - List List = new ArrayList<>(); JSONArray array = object.getJSONArray("orderItems"); @@ -2292,7 +2290,7 @@ public class HighOrderServiceImpl implements HighOrderService { if (!object1.getString("milkBubble").equals("")) { contentMap.put("milkBubble", object1.getString("milkBubble")); } - if (!object1.getString("num").equals("")) { + if (!"".equals(object1.getString("num"))) { contentMap.put("num", object1.getString("num")); } List.add(JSON.toJSONString(contentMap)); From 624fcba56785d12c96ab88c03020c740b8f9cc72 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Wed, 14 Sep 2022 21:39:35 +0800 Subject: [PATCH 20/24] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E5=85=AC=E5=8F=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/HighDiscountPackageController.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java index ded4edef..2fbd7056 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java @@ -164,9 +164,9 @@ public class HighDiscountPackageController { if (StringUtils.isBlank(highDiscountPackage.getTitle()) || highDiscountPackage.getSalesType() == null -// || StringUtils.isBlank(highDiscountPackage.getBannerImg()) -// || StringUtils.isBlank(highDiscountPackage.getListImg()) -// || StringUtils.isBlank(highDiscountPackage.getDetailsImg()) + || StringUtils.isBlank(highDiscountPackage.getBannerImg()) + || StringUtils.isBlank(highDiscountPackage.getListImg()) + || StringUtils.isBlank(highDiscountPackage.getDetailsImg()) ) { log.error("HighAgentController -> insertCouponPackageInfo() error!","参数错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); @@ -225,9 +225,9 @@ public class HighDiscountPackageController { if (StringUtils.isBlank(highDiscountPackage.getTitle()) || highDiscountPackage.getSalesType() == null || highDiscountPackage.getId() == null -// || StringUtils.isBlank(highDiscountPackage.getBannerImg()) -// || StringUtils.isBlank(highDiscountPackage.getListImg()) -// || StringUtils.isBlank(highDiscountPackage.getDetailsImg()) + || StringUtils.isBlank(highDiscountPackage.getBannerImg()) + || StringUtils.isBlank(highDiscountPackage.getListImg()) + || StringUtils.isBlank(highDiscountPackage.getDetailsImg()) ) { log.error("HighAgentController -> updateCouponPackageInfo() error!","参数错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); From 3ad6a64d708d4961e9065c8da18ff0fb5f0ac1bc Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Wed, 14 Sep 2022 21:51:52 +0800 Subject: [PATCH 21/24] 1 --- .../com/bweb/controller/HighDiscountPackageController.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java index 325deb77..ded4edef 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java @@ -164,9 +164,9 @@ public class HighDiscountPackageController { if (StringUtils.isBlank(highDiscountPackage.getTitle()) || highDiscountPackage.getSalesType() == null - || StringUtils.isBlank(highDiscountPackage.getBannerImg()) - || StringUtils.isBlank(highDiscountPackage.getListImg()) - || StringUtils.isBlank(highDiscountPackage.getDetailsImg()) +// || StringUtils.isBlank(highDiscountPackage.getBannerImg()) +// || StringUtils.isBlank(highDiscountPackage.getListImg()) +// || StringUtils.isBlank(highDiscountPackage.getDetailsImg()) ) { log.error("HighAgentController -> insertCouponPackageInfo() error!","参数错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); From b54c4e2678ee7c275200da7f1d75542f61fdf9ab Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Sat, 17 Sep 2022 10:18:46 +0800 Subject: [PATCH 22/24] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=98=9F=E5=B7=B4?= =?UTF-8?q?=E5=85=8B=E4=B8=8B=E6=9E=B6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/HighThirdPartyController.java | 33 ++++++++++++++++--- .../java/com/hai/common/utils/CommonUtil.java | 10 ++++++ .../com/hai/entity/ApiStarbucksProducts.java | 10 ++++++ 3 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 hai-service/src/main/java/com/hai/common/utils/CommonUtil.java diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java b/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java index 7b4d55bc..7ae4361e 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java @@ -35,6 +35,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; import java.math.RoundingMode; +import java.sql.Array; import java.util.*; import java.util.stream.Collectors; @@ -118,20 +119,44 @@ public class HighThirdPartyController { BigDecimal salesTallPrice = apiStarbucksProducts.getSalesTallPrice().add(apiStarbucksProducts.getMarketTallPrice().multiply(productDiscount.divide(new BigDecimal(100)))).setScale(2, RoundingMode.HALF_UP); BigDecimal salesGrandePrice = apiStarbucksProducts.getSalesGrandePrice().add(apiStarbucksProducts.getMarketGrandePrice().multiply(productDiscount.divide(new BigDecimal(100)))).setScale(2, RoundingMode.HALF_UP); - if (salesVentiPrice.compareTo(apiStarbucksProducts.getMarketVentiPrice()) > 0) { - salesVentiPrice = apiStarbucksProducts.getMarketVentiPrice(); - } + + + // 判断当前价格是否大雨原价 如果大于显示原价 if (salesTallPrice.compareTo(apiStarbucksProducts.getMarketTallPrice()) > 0) { salesTallPrice = apiStarbucksProducts.getMarketTallPrice(); } if (salesGrandePrice.compareTo(apiStarbucksProducts.getMarketGrandePrice()) > 0) { salesGrandePrice = apiStarbucksProducts.getMarketGrandePrice(); } + if (salesVentiPrice.compareTo(apiStarbucksProducts.getMarketVentiPrice()) > 0) { + salesVentiPrice = apiStarbucksProducts.getMarketVentiPrice(); + } + + String[] strings = apiStarbucksProducts.getCupSize().split(","); + + for (String string : strings) { + if ("中杯".equals(string)) { + apiStarbucksProducts.setShowPrice(salesTallPrice); + break; + } + if ("大杯".equals(string)) { + apiStarbucksProducts.setShowPrice(salesGrandePrice); + break; + } + if ("超大杯".equals(string)) { + apiStarbucksProducts.setShowPrice(salesVentiPrice); + break; + } + } + apiStarbucksProducts.setSalesVentiPrice(salesVentiPrice); apiStarbucksProducts.setSalesTallPrice(salesTallPrice); apiStarbucksProducts.setCount(0); apiStarbucksProducts.setSalesGrandePrice(salesGrandePrice); - starbucksProductsList.add(apiStarbucksProducts); + if (apiStarbucksProducts.getShowPrice() != null) { + starbucksProductsList.add(apiStarbucksProducts); + } + } starbucksProducts.setName(s); starbucksProducts.setExt2(SysConst.getSysConfig().getImgUrl() + ProductImgEnum.getNameByImgUrl(s)); diff --git a/hai-service/src/main/java/com/hai/common/utils/CommonUtil.java b/hai-service/src/main/java/com/hai/common/utils/CommonUtil.java new file mode 100644 index 00000000..96c0c6c3 --- /dev/null +++ b/hai-service/src/main/java/com/hai/common/utils/CommonUtil.java @@ -0,0 +1,10 @@ +package com.hai.common.utils; + +/** + * @author sum1dream + */ +public class CommonUtil { + + + +} diff --git a/hai-service/src/main/java/com/hai/entity/ApiStarbucksProducts.java b/hai-service/src/main/java/com/hai/entity/ApiStarbucksProducts.java index ea2e6d26..8cb38ec3 100644 --- a/hai-service/src/main/java/com/hai/entity/ApiStarbucksProducts.java +++ b/hai-service/src/main/java/com/hai/entity/ApiStarbucksProducts.java @@ -131,6 +131,16 @@ public class ApiStarbucksProducts implements Serializable { private Integer count; + private BigDecimal showPrice; + + public BigDecimal getShowPrice() { + return showPrice; + } + + public void setShowPrice(BigDecimal showPrice) { + this.showPrice = showPrice; + } + /** * ext_1 */ From 7ed5736e257f9c4688c221f58fe5b027166c01b7 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Mon, 19 Sep 2022 10:15:33 +0800 Subject: [PATCH 23/24] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=9D=E8=B4=B9?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/cweb/controller/HighThirdPartyController.java | 2 +- .../com/hai/service/impl/OutRechargeOrderServiceImpl.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java b/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java index 7ae4361e..ded7f07c 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java @@ -156,7 +156,7 @@ public class HighThirdPartyController { if (apiStarbucksProducts.getShowPrice() != null) { starbucksProductsList.add(apiStarbucksProducts); } - + } starbucksProducts.setName(s); starbucksProducts.setExt2(SysConst.getSysConfig().getImgUrl() + ProductImgEnum.getNameByImgUrl(s)); diff --git a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java index f4fc3dd7..adce9005 100644 --- a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java @@ -165,7 +165,8 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { DateUtil.format(MapUtils.getString(map, "createTimeS"), "yyyy-MM-dd HH:mm:ss"), DateUtil.format(MapUtils.getString(map, "createTimeE"), "yyyy-MM-dd HH:mm:ss")); } - if (MapUtils.getBoolean(map , "whetherTimeOut")) { + + if (MapUtils.getBoolean(map , "whetherTimeOut") != null && MapUtils.getBoolean(map , "whetherTimeOut")) { // 获取当前时间 Date date= new Date(); Calendar calendar = new GregorianCalendar(); @@ -175,7 +176,6 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { // 这个时间就是日期往后推一天的结果 date = calendar.getTime(); criteria.andCreateTimedLessThan(date); - } From 6d4259111b7ee6b582435931f2f95a56e06a423a Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Mon, 19 Sep 2022 11:57:59 +0800 Subject: [PATCH 24/24] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cweb/controller/CommonController.java | 9 +++++++ .../hai/service/impl/CommonServiceImpl.java | 26 ++++++++++--------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/hai-cweb/src/main/java/com/cweb/controller/CommonController.java b/hai-cweb/src/main/java/com/cweb/controller/CommonController.java index c81e4c34..9f7fa937 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/CommonController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/CommonController.java @@ -287,8 +287,17 @@ public class CommonController { ) { try { + + JSONObject jsonObjectR = commonService.findByLatAndLng(lng , lat); + + if (!jsonObjectR.getString("status").equals("0")) { + log.error("findByLatAndLng error!", "定位错误,请重新定位" ); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "定位错误,请重新定位"); + } + JSONObject object = commonService.findByLatAndLng(lng , lat).getJSONObject("result").getJSONObject("addressComponent"); + ApiCity apiCity = commonService.findCityByName(object.getString("city")); if (apiCity == null) { diff --git a/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java index 6ff7a0ed..ad6bbe8a 100644 --- a/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java @@ -534,18 +534,20 @@ public class CommonServiceImpl implements CommonService { @Override public JSONObject findByLatAndLng(String lng, String lat) throws Exception { - Map map = new HashMap<>();//参数 - map.put("ak", "SfrwGH7INvjPq7BwCrYrioBQZm9XXxrR");//申请百度开放平台KEY(ak) - map.put("output", "json");// 输出Json数据 - map.put("extensions_town", "true");// 行政区划返回乡镇级数据(town),仅国内召回乡镇数据 - map.put("coordtype", "wgs84ll"); // GPS 经纬度类型 - map.put("location", lat+","+lng+"");//百度经纬度 - - String url = "http://api.map.baidu.com/reverse_geocoding/v3/"; - - System.out.println("请求经纬度========" + map); - - return HttpsUtils.doGet(url , map); + //参数 + Map map = new HashMap<>(); + //申请百度开放平台KEY(ak) + map.put("ak", "SfrwGH7INvjPq7BwCrYrioBQZm9XXxrR"); + // 输出Json数据 + map.put("output", "json"); + // 行政区划返回乡镇级数据(town),仅国内召回乡镇数据 + map.put("extensions_town", "true"); + // GPS 经纬度类型 + map.put("coordtype", "wgs84ll"); + //百度经纬度 + map.put("location", lat+","+lng+""); + + return HttpsUtils.doGet("http://api.map.baidu.com/reverse_geocoding/v3/" , map); }