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/14] 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 497a7a30af8eb1c50716dd991812d1e456d3101f Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Fri, 2 Sep 2022 13:47:49 +0800 Subject: [PATCH 02/14] =?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 03/14] =?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 04/14] =?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 05/14] 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 06/14] =?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 07/14] =?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 08/14] =?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 09/14] =?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 10/14] 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 11/14] =?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 12/14] =?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 3aca2b3b0db383851e17d516f107741531559c02 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Mon, 19 Sep 2022 17:10:46 +0800 Subject: [PATCH 13/14] 1 --- .../src/main/java/com/hai/schedule/HighOrderSchedule.java | 2 +- .../java/com/hai/service/impl/OutRechargeOrderServiceImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 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 08175d5b..d0f3c7ee 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java @@ -101,7 +101,7 @@ public class HighOrderSchedule { public void initRechargeOrder() { Map map = new HashMap<>(); map.put("payStatus", String.valueOf(102)); - map.put("rechargeStatus", String.valueOf(204)); + map.put("rechargeStatus", String.valueOf(205)); List orderList = outRechargeOrderService.getListRechargeOrder(map); if (orderList.size() > 0) { for (OutRechargeOrder order : orderList) { 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 adce9005..8481a9be 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 @@ -975,7 +975,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { } if (childOrder.getStatus() == 103) { - outRechargeOrder.setRechargeStatus(204); + outRechargeOrder.setRechargeStatus(205); } outRechargeOrderService.updateOrder(outRechargeOrder); System.out.println("话费定时任务 -> 需要重新充值:结束"); From 9b0e07f03cf2f4ee42da715a2d182f1d0936b329 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Wed, 21 Sep 2022 13:45:29 +0800 Subject: [PATCH 14/14] 1 --- .../src/main/java/com/bweb/controller/HighTestController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java b/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java index 1f5711fa..50eb8a40 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java @@ -1 +1 @@ -package com.bweb.controller; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.alipay.api.domain.ForbbidenTime; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.utils.DateUtil; import com.hai.common.utils.IDGenerator; import com.hai.common.utils.ResponseMsgUtil; import com.hai.config.HuiLianTongConfig; import com.hai.config.HuiLianTongUnionCardConfig; import com.hai.config.QianZhuConfig; import com.hai.config.WxOrderConfig; import com.hai.entity.*; import com.hai.model.OrderRefundModel; import com.hai.model.ResponseData; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @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 OutRechargeOrderService outRechargeOrderService; @Resource private HighOrderService highOrderService; @Resource private HighUserService highUserService; @Resource private HighOilCardService oilCardService; @Resource private ApiProductService apiProductService; @Resource private BsRechargeCodeService rechargeCodeService; @Resource private OutRechargePriceService rechargePriceService; @RequestMapping(value = "/kfcRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "KFC退款") public ResponseData kfcRefund(@RequestParam(name = "orderNo", required = true) String orderNo,HttpServletRequest request) { try { OrderRefundModel orderRefundModel = null; if (StringUtils.isNotBlank(orderNo)) { // 查询订单 HighOrder order = highOrderService.getOrderByOrderNo(orderNo); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 6.退款中 7.拒绝退款 if (order != null && order.getOrderStatus() == 2) { orderRefundModel = WxOrderConfig.orderToRefund(order.getPaySerialNo(), order.getPayRealPrice(), "1609882817", order.getPayRealPrice()); if(orderRefundModel.getResult_code().equals("SUCCESS")) { for (HighChildOrder childOrder : order.getHighChildOrderList()) { childOrder.setChildOrdeStatus(4); } order.setOrderStatus(4); order.setRefundTime(new Date()); order.setRefundPrice(order.getPayRealPrice()); highOrderService.updateOrder(order); return ResponseMsgUtil.success(orderRefundModel); } } } return ResponseMsgUtil.success(orderRefundModel); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/oilCardRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "油卡退款") public ResponseData oilCardRefund(@RequestParam(name = "orderNo", required = true) String orderNo,HttpServletRequest request) { try { oilCardService.refund(orderNo); return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value="/resolveResponse",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "解析") public ResponseData resolveResponse( @RequestParam(name = "data", required = false) String data ) { try { JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponse(data); return ResponseMsgUtil.success(cardInfoObject); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value="/consumption",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡重新发起充值") public ResponseData consumption( @RequestParam(name = "orderNo", required = false) String orderNo ) { try { OutRechargeOrder order = outRechargeOrderService.findByOrderNo(orderNo); String goodsDesc = "重新充值"; String tranDesc = order.getRechargeContent() + "重新充值" + order.getPayRealPrice() + "元"; String instCode = "11101527"; String businessType = "hisen_consume"; String orderNoPost = "AGAIN" + DateUtil.date2String(new Date(), "yyyyMMddHHmmss") + IDGenerator.nextId(5); // 工会卡支付 JSONObject consumption = HuiLianTongUnionCardConfig.consumption(orderNoPost, order.getLaborUnionCard(), order.getPayRealPrice(), businessType, instCode, goodsDesc, tranDesc); JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponse(consumption.getString("data")); return ResponseMsgUtil.success(cardInfoObject); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getHuiLianTongCardConsume", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询汇联通工会卡消费记录") public ResponseData getHuiLianTongCardConsume(@RequestParam(name = "businessType", required = true) String businessType, @RequestParam(name = "cardNo", required = true) String cardNo, @RequestParam(name = "sdate", required = true) Long sdate, @RequestParam(name = "edate", required = true) Long edate, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) { try { JSONObject consumptionRecord = HuiLianTongUnionCardConfig.queryConsumptionRecordByBusiness(businessType, cardNo, sdate, edate, pageNum, pageSize); if (StringUtils.isBlank(consumptionRecord.getString("data"))) { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_ERROR, ""); } JSONArray array = HuiLianTongUnionCardConfig.resolveResponse(consumptionRecord.getString("data")).getJSONArray("records"); // // String s = "HFR1"; // String s1 = "AGAIN1"; // // List list = new ArrayList<>(); // // // for (Object data : array) { // JSONObject dataObject = (JSONObject) data; // if (!StringUtils.contains(dataObject.getString("orderNo"),s) && !StringUtils.contains(dataObject.getString("orderNo"),s1)) { // list.add(dataObject); // } // return ResponseMsgUtil.success(array); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardConsume() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/orderToRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "积分充值退款") public ResponseData orderToRefund(@RequestParam(name = "orderId", required = true) Long orderId ,HttpServletRequest request) { try { HighOrder highOrder = highOrderService.getOrderById(orderId); // 微信退款 OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(highOrder.getPaySerialNo(), highOrder.getPayRealPrice(), highOrder.getPayRealPrice()); if(orderRefundModel.getResult_code().equals("SUCCESS")) { for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) { childOrder.setChildOrdeStatus(4); } highOrder.setOrderStatus(4); highOrder.setRefundTime(new Date()); highOrder.setRefundPrice(highOrder.getPayRealPrice()); highOrderService.updateOrder(highOrder); } if (highUserService.findGoldRepeat(3 , highOrder.getId())) { String remark = "订单" + highOrder.getOrderNo() + "退款积分:" + highOrder.getPayRealPrice().multiply(BigDecimal.valueOf(100)).intValue(); highUserService.goldHandle(highOrder.getMemId(), highOrder.getPayRealPrice().multiply(BigDecimal.valueOf(100)).intValue(), 2, 3, highOrder.getId() , remark); }else { log.error("orderToPay error!", "已有退款记录"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已有退款记录"); } return ResponseMsgUtil.success(orderRefundModel); } catch (Exception e) { log.error("HighOrderController --> orderToRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/orderToRefundByHlt", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "汇联通充值退款") public ResponseData orderToRefundByHlt(@RequestParam(name = "orderId", required = true) Long orderId ,HttpServletRequest request) { try { HighOrder highOrder = highOrderService.getOrderById(orderId); // 微信退款 OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(highOrder.getPaySerialNo(), highOrder.getPayRealPrice(), WxOrderConfig.MCH_ID_1619676214 , highOrder.getPayRealPrice()); if(orderRefundModel.getResult_code().equals("SUCCESS")) { for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) { childOrder.setChildOrdeStatus(4); } highOrder.setOrderStatus(4); highOrder.setRefundTime(new Date()); highOrder.setRefundPrice(highOrder.getPayRealPrice()); highOrderService.updateOrder(highOrder); } return ResponseMsgUtil.success(orderRefundModel); } catch (Exception e) { log.error("HighOrderController --> orderToRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/rechargeOrderToRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "话费退款") public ResponseData rechargeOrderToRefund( @RequestParam(name = "orderId", required = true) Long orderId) { try { outRechargeOrderService.rechargeOrderToRefund(orderId); return ResponseMsgUtil.success("退款成功"); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getStarbucksProducts", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "更新星巴克商品") public ResponseData getStarbucksProducts(HttpServletRequest request) { try { JSONObject jsonObject = QianZhuConfig.getStarbucksProducts(1 , 200); JSONObject object = jsonObject.getJSONObject("data"); JSONArray array = object.getJSONArray("items"); for (Object data : array) { JSONObject dataObject = (JSONObject) data; ApiStarbucksProducts starbucksProducts = apiProductService.findStarbucksProductsByGoodsId(dataObject.getLong("id")); if (dataObject.getInteger("shelfStatus") == 5) { if (starbucksProducts == null) { starbucksProducts = new ApiStarbucksProducts(); } starbucksProducts.setCategoryName(dataObject.getString("categoryName")); starbucksProducts.setCream(dataObject.getString("cream")); starbucksProducts.setCupSize(dataObject.getString("cupSize")); starbucksProducts.setDefaultImage(dataObject.getString("defaultImage")); starbucksProducts.setDes(dataObject.getString("des")); starbucksProducts.setEspresso(dataObject.getString("espresso")); starbucksProducts.setMarketGrandePrice(dataObject.getBigDecimal("marketGrandePrice")); starbucksProducts.setMarketTallPrice(dataObject.getBigDecimal("marketTallPrice")); starbucksProducts.setMarketVentiPrice(dataObject.getBigDecimal("marketVentiPrice")); starbucksProducts.setSalesGrandePrice(dataObject.getBigDecimal("salesGrandePrice")); starbucksProducts.setSalesTallPrice(dataObject.getBigDecimal("salesTallPrice")); starbucksProducts.setSalesVentiPrice(dataObject.getBigDecimal("salesVentiPrice")); starbucksProducts.setMilk(dataObject.getString("milk")); starbucksProducts.setMilkBubble(dataObject.getString("milkBubble")); starbucksProducts.setName(dataObject.getString("name")); starbucksProducts.setTemperature(dataObject.getString("temperature")); if (starbucksProducts.getId() == null) { starbucksProducts.setCreateTime(new Date()); starbucksProducts.setOperatorId(9999L); starbucksProducts.setOperatorName("系统生成"); starbucksProducts.setStatus(100); starbucksProducts.setGoodsId(dataObject.getLong("id")); apiProductService.insertStarbucksProducts(starbucksProducts); } else { starbucksProducts.setUpdateTime(new Date()); apiProductService.updateStarbucksProducts(starbucksProducts); } } } return ResponseMsgUtil.success("商品生成成功"); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getKfcStore", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询肯德基门店") public ResponseData getKfcStore(HttpServletRequest request) { try { JSONObject jsonObject = QianZhuConfig.getKfcStore(); JSONArray object = jsonObject.getJSONArray("data"); for (Object data : object) { JSONObject dataObject = (JSONObject) data; Map mapStore = new HashMap<>(); mapStore.put("storeCode" , dataObject.getString("storeCode")); ApiKfcStores apiKfcStores = apiProductService.findKfcStores(mapStore); if (apiKfcStores == null) { apiKfcStores = new ApiKfcStores(); } apiKfcStores.setProvinceCode(dataObject.getString("provinceCode")); apiKfcStores.setProvinceName(dataObject.getString("provinceName")); apiKfcStores.setCityCode(dataObject.getString("cityCode")); apiKfcStores.setCityName(dataObject.getString("cityName")); apiKfcStores.setCityNameFirstLetter(dataObject.getString("cityNameFirstLetter")); apiKfcStores.setKfcCityId(dataObject.getInteger("kfcCityId")); apiKfcStores.setKfcCityCode(dataObject.getString("kfcCityCode")); apiKfcStores.setStoreName(dataObject.getString("storeName")); apiKfcStores.setStoreCode(dataObject.getString("storeCode")); apiKfcStores.setLon(dataObject.getString("lon")); apiKfcStores.setLat(dataObject.getString("lat")); apiKfcStores.setAddress(dataObject.getString("address")); apiKfcStores.setStartTime(dataObject.getString("startTime")); apiKfcStores.setEndTime(dataObject.getString("endTime")); apiKfcStores.setStoreStatus(dataObject.getInteger("storeStatus")); apiKfcStores.setShelfStatus(dataObject.getInteger("shelfStatus")); if (apiKfcStores.getId() == null) { apiKfcStores.setCreateTime(new Date()); apiKfcStores.setOperatorId(9999L); apiKfcStores.setOperatorName("系统生成"); apiKfcStores.setStatus(100); apiProductService.insertKfcStore(apiKfcStores); } else { apiKfcStores.setUpdateTime(new Date()); apiProductService.updateKfcStore(apiKfcStores); } } return ResponseMsgUtil.success("生成成功"); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/insertCity", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "插入城市") public ResponseData insertCity(HttpServletRequest request) { try { JSONObject jsonObject = QianZhuConfig.getAllCities(); JSONArray object = jsonObject.getJSONArray("data"); for (Object data : object) { JSONObject dataObject = (JSONObject) data; ApiCity apiCity = new ApiCity(); apiCity.setCityInitial(dataObject.getString("cityInitial")); apiCity.setCityCode(dataObject.getString("cityCode")); apiCity.setCityName(dataObject.getString("cityName")); apiCity.setProvinceCode(dataObject.getString("provinceCode")); apiCity.setProvinceName(dataObject.getString("provinceName")); apiCity.setCreateTime(new Date()); apiCity.setUpdateTime(new Date()); apiCity.setOperatorId(9999L); apiCity.setOperatorName("系统生成"); apiCity.setStatus(100); apiProductService.insertCity(apiCity); } return ResponseMsgUtil.success("生成成功"); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/updatePrice", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "更新价格") public ResponseData updatePrice() { try { List list = rechargePriceService.getListRechargePrice(new HashMap<>()); for (OutRechargePrice rechargePrice : list) { BsRechargeCode rechargeCode = new BsRechargeCode(); if (rechargePrice.getGoodsId() != null) { rechargeCode.setStatus(100); rechargeCode.setUpdateTime(new Date()); rechargeCode.setCreateTime(new Date()); rechargeCode.setGoodsId(rechargePrice.getGoodsId().toString()); rechargeCode.setOperatorName("系统自动更新"); rechargeCode.setType(1); rechargeCode.setSourceId(rechargePrice.getId().toString()); rechargeCode.setRechargePlatform(2); rechargeCodeService.insertRechargeCode(rechargeCode); } } return ResponseMsgUtil.success("生成成功"); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/test", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "测试") public ResponseData test(@RequestBody JSONObject object) { try { return ResponseMsgUtil.success(HuiLianTongConfig.test(object)); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/下单", 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); } } } \ No newline at end of file +package com.bweb.controller; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.alipay.api.domain.ForbbidenTime; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.utils.DateUtil; import com.hai.common.utils.IDGenerator; import com.hai.common.utils.ResponseMsgUtil; import com.hai.config.HuiLianTongConfig; import com.hai.config.HuiLianTongUnionCardConfig; import com.hai.config.QianZhuConfig; import com.hai.config.WxOrderConfig; import com.hai.entity.*; import com.hai.model.OrderRefundModel; import com.hai.model.ResponseData; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @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 OutRechargeOrderService outRechargeOrderService; @Resource private HighOrderService highOrderService; @Resource private HighUserService highUserService; @Resource private HighOilCardService oilCardService; @Resource private ApiProductService apiProductService; @Resource private BsRechargeCodeService rechargeCodeService; @Resource private OutRechargePriceService rechargePriceService; @RequestMapping(value = "/kfcRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "KFC退款") public ResponseData kfcRefund(@RequestParam(name = "orderNo", required = true) String orderNo,HttpServletRequest request) { try { OrderRefundModel orderRefundModel = null; if (StringUtils.isNotBlank(orderNo)) { // 查询订单 HighOrder order = highOrderService.getOrderByOrderNo(orderNo); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 6.退款中 7.拒绝退款 if (order != null && order.getOrderStatus() == 2) { orderRefundModel = WxOrderConfig.orderToRefund(order.getPaySerialNo(), order.getPayRealPrice(), "1609882817", order.getPayRealPrice()); if(orderRefundModel.getResult_code().equals("SUCCESS")) { for (HighChildOrder childOrder : order.getHighChildOrderList()) { childOrder.setChildOrdeStatus(4); } order.setOrderStatus(4); order.setRefundTime(new Date()); order.setRefundPrice(order.getPayRealPrice()); highOrderService.updateOrder(order); return ResponseMsgUtil.success(orderRefundModel); } } } return ResponseMsgUtil.success(orderRefundModel); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/oilCardRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "油卡退款") public ResponseData oilCardRefund(@RequestParam(name = "orderNo", required = true) String orderNo,HttpServletRequest request) { try { oilCardService.refund(orderNo); return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value="/resolveResponse",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "解析") public ResponseData resolveResponse( @RequestParam(name = "data", required = false) String data ) { try { JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponse(data); return ResponseMsgUtil.success(cardInfoObject); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value="/consumption",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡重新发起充值") public ResponseData consumption( @RequestParam(name = "orderNo", required = false) String orderNo ) { try { OutRechargeOrder order = outRechargeOrderService.findByOrderNo(orderNo); String goodsDesc = "重新充值"; String tranDesc = order.getRechargeContent() + "重新充值" + order.getPayRealPrice() + "元"; String instCode = "11101527"; String businessType = "hisen_consume"; String orderNoPost = "AGAIN" + DateUtil.date2String(new Date(), "yyyyMMddHHmmss") + IDGenerator.nextId(5); // 工会卡支付 JSONObject consumption = HuiLianTongUnionCardConfig.consumption(orderNoPost, order.getLaborUnionCard(), order.getPayRealPrice(), businessType, instCode, goodsDesc, tranDesc); JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponse(consumption.getString("data")); return ResponseMsgUtil.success(cardInfoObject); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getHuiLianTongCardConsume", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询汇联通工会卡消费记录") public ResponseData getHuiLianTongCardConsume(@RequestParam(name = "businessType", required = true) String businessType, @RequestParam(name = "cardNo", required = true) String cardNo, @RequestParam(name = "sdate", required = true) Long sdate, @RequestParam(name = "edate", required = true) Long edate, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) { try { JSONObject consumptionRecord = HuiLianTongUnionCardConfig.queryConsumptionRecordByBusiness(businessType, cardNo, sdate, edate, pageNum, pageSize); if (StringUtils.isBlank(consumptionRecord.getString("data"))) { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_ERROR, ""); } JSONArray array = HuiLianTongUnionCardConfig.resolveResponse(consumptionRecord.getString("data")).getJSONArray("records"); // // String s = "HFR1"; // String s1 = "AGAIN1"; // // List list = new ArrayList<>(); // // // for (Object data : array) { // JSONObject dataObject = (JSONObject) data; // if (!StringUtils.contains(dataObject.getString("orderNo"),s) && !StringUtils.contains(dataObject.getString("orderNo"),s1)) { // list.add(dataObject); // } // return ResponseMsgUtil.success(array); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardConsume() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/orderToRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "积分充值退款") public ResponseData orderToRefund(@RequestParam(name = "orderId", required = true) Long orderId ,HttpServletRequest request) { try { HighOrder highOrder = highOrderService.getOrderById(orderId); // 微信退款 OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(highOrder.getPaySerialNo(), highOrder.getPayRealPrice(), highOrder.getPayRealPrice()); if(orderRefundModel.getResult_code().equals("SUCCESS")) { for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) { childOrder.setChildOrdeStatus(4); } highOrder.setOrderStatus(4); highOrder.setRefundTime(new Date()); highOrder.setRefundPrice(highOrder.getPayRealPrice()); highOrderService.updateOrder(highOrder); } if (highUserService.findGoldRepeat(3 , highOrder.getId())) { String remark = "订单" + highOrder.getOrderNo() + "退款积分:" + highOrder.getPayRealPrice().multiply(BigDecimal.valueOf(100)).intValue(); highUserService.goldHandle(highOrder.getMemId(), highOrder.getPayRealPrice().multiply(BigDecimal.valueOf(100)).intValue(), 2, 3, highOrder.getId() , remark); }else { log.error("orderToPay error!", "已有退款记录"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已有退款记录"); } return ResponseMsgUtil.success(orderRefundModel); } catch (Exception e) { log.error("HighOrderController --> orderToRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/orderToRefundByHlt", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "汇联通充值退款") public ResponseData orderToRefundByHlt(@RequestParam(name = "orderId", required = true) Long orderId ,HttpServletRequest request) { try { HighOrder highOrder = highOrderService.getOrderById(orderId); // 微信退款 OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(highOrder.getPaySerialNo(), highOrder.getPayRealPrice(), WxOrderConfig.MCH_ID_1619676214 , highOrder.getPayRealPrice()); if(orderRefundModel.getResult_code().equals("SUCCESS")) { for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) { childOrder.setChildOrdeStatus(4); } highOrder.setOrderStatus(4); highOrder.setRefundTime(new Date()); highOrder.setRefundPrice(highOrder.getPayRealPrice()); highOrderService.updateOrder(highOrder); } return ResponseMsgUtil.success(orderRefundModel); } catch (Exception e) { log.error("HighOrderController --> orderToRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/rechargeOrderToRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "话费退款") public ResponseData rechargeOrderToRefund( @RequestParam(name = "orderId", required = true) Long orderId) { try { outRechargeOrderService.rechargeOrderToRefund(orderId); return ResponseMsgUtil.success("退款成功"); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/refund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "退款") public ResponseData refund(@RequestParam(name = "orderId", required = true) Long orderId ,HttpServletRequest request) { try { HighOrder highOrder = highOrderService.getOrderById(orderId); // 微信退款 OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(highOrder.getPaySerialNo(), highOrder.getPayRealPrice(), WxOrderConfig.MCH_ID_1609882817 , highOrder.getPayRealPrice()); return ResponseMsgUtil.success(orderRefundModel); } catch (Exception e) { log.error("HighOrderController --> orderToRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getStarbucksProducts", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "更新星巴克商品") public ResponseData getStarbucksProducts(HttpServletRequest request) { try { JSONObject jsonObject = QianZhuConfig.getStarbucksProducts(1 , 200); JSONObject object = jsonObject.getJSONObject("data"); JSONArray array = object.getJSONArray("items"); for (Object data : array) { JSONObject dataObject = (JSONObject) data; ApiStarbucksProducts starbucksProducts = apiProductService.findStarbucksProductsByGoodsId(dataObject.getLong("id")); if (dataObject.getInteger("shelfStatus") == 5) { if (starbucksProducts == null) { starbucksProducts = new ApiStarbucksProducts(); } starbucksProducts.setCategoryName(dataObject.getString("categoryName")); starbucksProducts.setCream(dataObject.getString("cream")); starbucksProducts.setCupSize(dataObject.getString("cupSize")); starbucksProducts.setDefaultImage(dataObject.getString("defaultImage")); starbucksProducts.setDes(dataObject.getString("des")); starbucksProducts.setEspresso(dataObject.getString("espresso")); starbucksProducts.setMarketGrandePrice(dataObject.getBigDecimal("marketGrandePrice")); starbucksProducts.setMarketTallPrice(dataObject.getBigDecimal("marketTallPrice")); starbucksProducts.setMarketVentiPrice(dataObject.getBigDecimal("marketVentiPrice")); starbucksProducts.setSalesGrandePrice(dataObject.getBigDecimal("salesGrandePrice")); starbucksProducts.setSalesTallPrice(dataObject.getBigDecimal("salesTallPrice")); starbucksProducts.setSalesVentiPrice(dataObject.getBigDecimal("salesVentiPrice")); starbucksProducts.setMilk(dataObject.getString("milk")); starbucksProducts.setMilkBubble(dataObject.getString("milkBubble")); starbucksProducts.setName(dataObject.getString("name")); starbucksProducts.setTemperature(dataObject.getString("temperature")); if (starbucksProducts.getId() == null) { starbucksProducts.setCreateTime(new Date()); starbucksProducts.setOperatorId(9999L); starbucksProducts.setOperatorName("系统生成"); starbucksProducts.setStatus(100); starbucksProducts.setGoodsId(dataObject.getLong("id")); apiProductService.insertStarbucksProducts(starbucksProducts); } else { starbucksProducts.setUpdateTime(new Date()); apiProductService.updateStarbucksProducts(starbucksProducts); } } } return ResponseMsgUtil.success("商品生成成功"); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getKfcStore", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询肯德基门店") public ResponseData getKfcStore(HttpServletRequest request) { try { JSONObject jsonObject = QianZhuConfig.getKfcStore(); JSONArray object = jsonObject.getJSONArray("data"); for (Object data : object) { JSONObject dataObject = (JSONObject) data; Map mapStore = new HashMap<>(); mapStore.put("storeCode" , dataObject.getString("storeCode")); ApiKfcStores apiKfcStores = apiProductService.findKfcStores(mapStore); if (apiKfcStores == null) { apiKfcStores = new ApiKfcStores(); } apiKfcStores.setProvinceCode(dataObject.getString("provinceCode")); apiKfcStores.setProvinceName(dataObject.getString("provinceName")); apiKfcStores.setCityCode(dataObject.getString("cityCode")); apiKfcStores.setCityName(dataObject.getString("cityName")); apiKfcStores.setCityNameFirstLetter(dataObject.getString("cityNameFirstLetter")); apiKfcStores.setKfcCityId(dataObject.getInteger("kfcCityId")); apiKfcStores.setKfcCityCode(dataObject.getString("kfcCityCode")); apiKfcStores.setStoreName(dataObject.getString("storeName")); apiKfcStores.setStoreCode(dataObject.getString("storeCode")); apiKfcStores.setLon(dataObject.getString("lon")); apiKfcStores.setLat(dataObject.getString("lat")); apiKfcStores.setAddress(dataObject.getString("address")); apiKfcStores.setStartTime(dataObject.getString("startTime")); apiKfcStores.setEndTime(dataObject.getString("endTime")); apiKfcStores.setStoreStatus(dataObject.getInteger("storeStatus")); apiKfcStores.setShelfStatus(dataObject.getInteger("shelfStatus")); if (apiKfcStores.getId() == null) { apiKfcStores.setCreateTime(new Date()); apiKfcStores.setOperatorId(9999L); apiKfcStores.setOperatorName("系统生成"); apiKfcStores.setStatus(100); apiProductService.insertKfcStore(apiKfcStores); } else { apiKfcStores.setUpdateTime(new Date()); apiProductService.updateKfcStore(apiKfcStores); } } return ResponseMsgUtil.success("生成成功"); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/insertCity", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "插入城市") public ResponseData insertCity(HttpServletRequest request) { try { JSONObject jsonObject = QianZhuConfig.getAllCities(); JSONArray object = jsonObject.getJSONArray("data"); for (Object data : object) { JSONObject dataObject = (JSONObject) data; ApiCity apiCity = new ApiCity(); apiCity.setCityInitial(dataObject.getString("cityInitial")); apiCity.setCityCode(dataObject.getString("cityCode")); apiCity.setCityName(dataObject.getString("cityName")); apiCity.setProvinceCode(dataObject.getString("provinceCode")); apiCity.setProvinceName(dataObject.getString("provinceName")); apiCity.setCreateTime(new Date()); apiCity.setUpdateTime(new Date()); apiCity.setOperatorId(9999L); apiCity.setOperatorName("系统生成"); apiCity.setStatus(100); apiProductService.insertCity(apiCity); } return ResponseMsgUtil.success("生成成功"); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/updatePrice", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "更新价格") public ResponseData updatePrice() { try { List list = rechargePriceService.getListRechargePrice(new HashMap<>()); for (OutRechargePrice rechargePrice : list) { BsRechargeCode rechargeCode = new BsRechargeCode(); if (rechargePrice.getGoodsId() != null) { rechargeCode.setStatus(100); rechargeCode.setUpdateTime(new Date()); rechargeCode.setCreateTime(new Date()); rechargeCode.setGoodsId(rechargePrice.getGoodsId().toString()); rechargeCode.setOperatorName("系统自动更新"); rechargeCode.setType(1); rechargeCode.setSourceId(rechargePrice.getId().toString()); rechargeCode.setRechargePlatform(2); rechargeCodeService.insertRechargeCode(rechargeCode); } } return ResponseMsgUtil.success("生成成功"); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/test", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "测试") public ResponseData test(@RequestBody JSONObject object) { try { return ResponseMsgUtil.success(HuiLianTongConfig.test(object)); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/下单", 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); } } } \ No newline at end of file