提交代码

dev-discount
胡锐 3 years ago
parent ed2362c57a
commit 81b3c7bf33
  1. 46
      hai-bweb/src/main/java/com/bweb/controller/HighDiscountAgentRelController.java
  2. 2
      hai-cweb/src/main/java/com/cweb/controller/SmsContentController.java
  3. 10
      hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java
  4. 10
      hai-cweb/src/main/java/com/cweb/controller/pay/WechatPayController.java
  5. 2
      hai-cweb/src/main/java/com/cweb/controller/testController.java
  6. 2
      hai-service/src/main/java/com/hai/common/pay/util/sdk/WXPayReport.java
  7. 2
      hai-service/src/main/java/com/hai/common/pay/util/sdk/WXPayUtil.java
  8. 2
      hai-service/src/main/java/com/hai/common/utils/IdCardUtil.java
  9. 2
      hai-service/src/main/java/com/hai/common/utils/MemberValidateUtil.java
  10. 2
      hai-service/src/main/java/com/hai/common/utils/WxUtils.java
  11. 2
      hai-service/src/main/java/com/hai/dao/HighActivityAwardUserMapperExt.java
  12. 59
      hai-service/src/main/java/com/hai/dao/HighDiscountAgentCodeMapperExt.java
  13. 6
      hai-service/src/main/java/com/hai/service/HighDiscountAgentCodeService.java
  14. 24
      hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentCodeServiceImpl.java
  15. 4
      hai-service/src/main/java/com/hai/service/pay/impl/TestPayService.java

@ -182,6 +182,52 @@ public class HighDiscountAgentRelController {
} }
} }
@RequestMapping(value="/getDiscountUseConditionList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询优惠券使用情况")
public ResponseData getDiscountUseConditionList(@RequestParam(name = "discountId", required = false) Long discountId,
@RequestParam(name = "discountName", required = false) String discountName,
@RequestParam(name = "storeName", required = false) String storeName,
@RequestParam(name = "status", required = false) Integer status,
@RequestParam(name = "receiveTimeS", required = false) Long receiveTimeS,
@RequestParam(name = "receiveTimeE", required = false) Long receiveTimeE,
@RequestParam(name = "useTimeS", required = false) Long useTimeS,
@RequestParam(name = "useTimeE", required = false) Long useTimeE,
@RequestParam(name = "idS", required = false) Long idS,
@RequestParam(name = "idE", required = false) Long idE,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize,
HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (userInfoModel.getHighAgent() == null) {
log.error("HighCouponController -> insertCoupon() error!","该主角色没有权限");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, "");
}
Map<String, Object> map = new HashMap<>();
map.put("agentId", userInfoModel.getHighAgent().getId());
map.put("discountId", discountId);
map.put("discountName", discountName);
map.put("storeName", storeName);
map.put("status", status);
map.put("receiveTimeS", receiveTimeS);
map.put("receiveTimeE", receiveTimeE);
map.put("useTimeS", useTimeS);
map.put("useTimeE", useTimeE);
map.put("idS", idS);
map.put("idE", idE);
PageHelper.startPage(pageNum,pageSize);
return ResponseMsgUtil.success(new PageInfo<>(highDiscountAgentCodeService.getDiscountUseConditionList(map)));
} catch (Exception e) {
log.error("HighDiscountController -> getDiscountUseConditionList() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getDiscountCodeById",method = RequestMethod.GET) @RequestMapping(value="/getDiscountCodeById",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "查询优惠券码 详情") @ApiOperation(value = "查询优惠券码 详情")

@ -150,7 +150,7 @@ public class SmsContentController {
String line = null; String line = null;
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();
while ((line = br.readLine()) != null) { // 读取数据 while ((line = br.readLine()) != null) { // 读取数据
result.append(line + "\n"); result.append(line + "");
} }
connection.disconnect(); connection.disconnect();
System.out.println(result.toString()); System.out.println(result.toString());

@ -624,10 +624,10 @@ public class OrderController {
} }
String buildMessage(String method, String url, long timestamp, String nonceStr, String body) { String buildMessage(String method, String url, long timestamp, String nonceStr, String body) {
return method + "\n" return method + ""
+ url + "\n" + url + ""
+ timestamp + "\n" + timestamp + ""
+ nonceStr + "\n" + nonceStr + ""
+ body + "\n"; + body + "";
} }
} }

@ -202,11 +202,11 @@ public class WechatPayController {
} }
String buildMessage(String method, String url, long timestamp, String nonceStr, String body) { String buildMessage(String method, String url, long timestamp, String nonceStr, String body) {
return method + "\n" return method + ""
+ url + "\n" + url + ""
+ timestamp + "\n" + timestamp + ""
+ nonceStr + "\n" + nonceStr + ""
+ body + "\n"; + body + "";
} }
@RequestMapping(value = "/telApi", method = RequestMethod.GET) @RequestMapping(value = "/telApi", method = RequestMethod.GET)

@ -100,7 +100,7 @@ public class testController {
String line = null; String line = null;
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();
while ((line = br.readLine()) != null) { // 读取数据 while ((line = br.readLine()) != null) { // 读取数据
result.append(line + "\n"); result.append(line + "");
} }
connection.disconnect(); connection.disconnect();
System.out.println(result.toString()); System.out.println(result.toString());

@ -155,7 +155,7 @@ public class WXPayReport {
break; break;
} }
else { else {
sb.append("\n"); sb.append("");
sb.append(msg); sb.append(msg);
} }
} }

@ -92,7 +92,7 @@ public class WXPayUtil {
StringWriter writer = new StringWriter(); StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer); StreamResult result = new StreamResult(writer);
transformer.transform(source, result); transformer.transform(source, result);
String output = writer.getBuffer().toString(); //.replaceAll("\n|\r", ""); String output = writer.getBuffer().toString(); //.replaceAll("|\r", "");
try { try {
writer.close(); writer.close();
} }

@ -86,7 +86,7 @@ public class IdCardUtil {
public static String replaceBlank(String str) { public static String replaceBlank(String str) {
String dest = ""; String dest = "";
if (str!=null) { if (str!=null) {
Pattern p = Pattern.compile("\\s*|\t|\r|\n"); Pattern p = Pattern.compile("\\s*|\t|\r|");
Matcher m = p.matcher(str); Matcher m = p.matcher(str);
dest = m.replaceAll(""); dest = m.replaceAll("");
} }

@ -99,7 +99,7 @@ public class MemberValidateUtil {
public static String replaceBlank(String str) { public static String replaceBlank(String str) {
String dest = ""; String dest = "";
if (str!=null) { if (str!=null) {
Pattern p = Pattern.compile("\\s*|\t|\r|\n"); Pattern p = Pattern.compile("\\s*|\t|\r|");
Matcher m = p.matcher(str); Matcher m = p.matcher(str);
dest = m.replaceAll(""); dest = m.replaceAll("");
} }

@ -335,7 +335,7 @@ public class WxUtils {
StringWriter writer = new StringWriter(); StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer); StreamResult result = new StreamResult(writer);
transformer.transform(source, result); transformer.transform(source, result);
String output = writer.getBuffer().toString(); //.replaceAll("\n|\r", ""); String output = writer.getBuffer().toString(); //.replaceAll("|\r", "");
try { try {
writer.close(); writer.close();
} }

@ -11,7 +11,7 @@ import java.util.Map;
*/ */
public interface HighActivityAwardUserMapperExt { public interface HighActivityAwardUserMapperExt {
@Select(" select insert(b.phone, 4, 4, '****') phone,a.name awardName,a.create_time receiveTime from \n" + @Select(" select insert(b.phone, 4, 4, '****') phone,a.name awardName,a.create_time receiveTime from " +
" (select a.create_time, b.name,a.user_id " + " (select a.create_time, b.name,a.user_id " +
" from high_activity_award_user a,high_activity_award b " + " from high_activity_award_user a,high_activity_award b " +
" where a.activity_award_id = b.id and a.activity_info_id = #{activityId} " + " where a.activity_award_id = b.id and a.activity_info_id = #{activityId} " +

@ -3,8 +3,10 @@ package com.hai.dao;
import com.hai.entity.HighDiscountAgentCode; import com.hai.entity.HighDiscountAgentCode;
import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* mapper扩展类 * mapper扩展类
@ -30,4 +32,61 @@ public interface HighDiscountAgentCodeMapperExt {
}) })
void insertListCode(@Param(value = "list") List<HighDiscountAgentCode> discountAgentCodeList); void insertListCode(@Param(value = "list") List<HighDiscountAgentCode> discountAgentCodeList);
@Select({"<script>" +
" SELECT" +
" a.id," +
" a.`status`," +
" a.create_time createTime," +
" c.discountId," +
" c.discountName," +
" b.receiveTime," +
" b.useEndTime," +
" b.useTime," +
" b.userId," +
" b.userName," +
" insert(b.userPhone, 4, 4, '****') userPhone," +
" b.storeName" +
" FROM" +
" high_discount_agent_code a" +
" LEFT JOIN (" +
" SELECT" +
" du.discount_agent_code_id," +
" du.create_time receiveTime," +
" du.use_end_time useEndTime," +
" du.use_time useTime," +
" u.id userId," +
" u.`name` userName," +
" u.phone userPhone," +
" c.store_name storeName" +
" FROM" +
" high_discount_user_rel du" +
" LEFT JOIN high_user u ON u.id = du.user_id " +
" LEFT JOIN (select a.mem_discount_id,b.store_name from (select b.id,a.mem_discount_id from high_order a" +
" left join high_child_order b on a.id = b.order_id " +
" where a.mem_discount_id is not null " +
" and a.order_status in (2,3,4,6,7)" +
" and b.giveaway_type = 0) a,high_coupon_code b where a.id = b.child_order_id GROUP BY a.mem_discount_id) c on c.mem_discount_id = du.id" +
" GROUP BY" +
" du.id " +
" ) b ON b.discount_agent_code_id = a.id " +
" LEFT JOIN (select " +
" ca.id discountAgentCodeId," +
" hd.id discountId," +
" hd.discount_name discountName from high_discount_agent_code ca,high_discount_agent_rel cb,high_discount hd " +
" where ca.discount_agent_id = cb.id and cb.discount_id = hd.id) c on c.discountAgentCodeId = a.id" +
" WHERE" +
" a.discount_agent_id IN (SELECT id FROM high_discount_agent_rel WHERE agent_id = #{param.agentId} and status = 1)" +
" <if test='param.status != null'> and a.`status` = #{param.status} </if> " +
" <if test='param.discountId != null'> and c.discountId = #{param.discountId} </if> " +
" <if test='param.discountName != null'> and c.discountName like concat('%',#{param.discountName},'%') </if> " +
" <if test='param.storeName != null'> and b.storeName like concat('%',#{param.storeName},'%') </if> " +
" <if test='param.receiveTimeS != null'> <![CDATA[ and b.receiveTime >= #{param.receiveTimeS} ]]> </if> " +
" <if test='param.receiveTimeE != null'> <![CDATA[ and b.receiveTime <= #{param.receiveTimeE} ]]> </if> " +
" <if test='param.useTimeS != null'> <![CDATA[ and b.useTime >= #{param.useTimeS} ]]> </if> " +
" <if test='param.useTimeE != null'> <![CDATA[ and b.useTime <= #{param.useTimeE} ]]> </if> " +
" <if test='param.idS != null'> <![CDATA[ and a.id >= #{param.idS} ]]> </if> " +
" <if test='param.idE != null'> <![CDATA[ and a.id <= #{param.idE} ]]> </if> " +
"</script>"})
List<Map<String,Object>> getDiscountUseConditionList(@Param("param") Map<String, Object> param);
} }

@ -41,6 +41,12 @@ public interface HighDiscountAgentCodeService {
**/ **/
List<HighDiscountAgentCode> getDiscountCode(Map<String,Object> map); List<HighDiscountAgentCode> getDiscountCode(Map<String,Object> map);
/**
* 优惠券使用情况列表
* @param map
* @return
*/
List<Map<String, Object>> getDiscountUseConditionList(Map<String,Object> map);
/** /**
* @Author Sum1Dream * @Author Sum1Dream

@ -1,5 +1,6 @@
package com.hai.service.impl; package com.hai.service.impl;
import com.hai.common.utils.DateUtil;
import com.hai.dao.HighCouponCodeMapper; import com.hai.dao.HighCouponCodeMapper;
import com.hai.dao.HighDiscountAgentCodeMapper; import com.hai.dao.HighDiscountAgentCodeMapper;
import com.hai.entity.*; import com.hai.entity.*;
@ -10,6 +11,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -91,6 +93,28 @@ public class HighDiscountAgentCodeServiceImpl implements HighDiscountAgentCodeSe
return list; return list;
} }
@Override
public List<Map<String, Object>> getDiscountUseConditionList(Map<String, Object> map) {
try {
if (MapUtils.getLong(map, "receiveTimeS") != null) {
map.put("receiveTimeS", DateUtil.date2String(new Date(MapUtils.getLong(map, "receiveTimeS")), "yyyy-MM-dd HH:mm:ss"));
}
if (MapUtils.getLong(map, "receiveTimeE") != null) {
map.put("receiveTimeE", DateUtil.date2String(new Date(MapUtils.getLong(map, "receiveTimeE")), "yyyy-MM-dd HH:mm:ss"));
}
if (MapUtils.getLong(map, "useTimeS") != null) {
map.put("useTimeS", DateUtil.date2String(new Date(MapUtils.getLong(map, "useTimeS")), "yyyy-MM-dd HH:mm:ss"));
}
if (MapUtils.getLong(map, "useTimeE") != null) {
map.put("useTimeE", DateUtil.date2String(new Date(MapUtils.getLong(map, "useTimeE")), "yyyy-MM-dd HH:mm:ss"));
}
} catch (Exception e) {
e.printStackTrace();
}
return highDiscountAgentCodeMapper.getDiscountUseConditionList(map);
}
@Override @Override
public List<HighDiscountAgentCode> getDiscountCodeByDiscountAgentId(Long discountAgentId) { public List<HighDiscountAgentCode> getDiscountCodeByDiscountAgentId(Long discountAgentId) {

@ -15,8 +15,8 @@ public class TestPayService implements PayService {
@Override @Override
public void paySuccess(Map<String, String> map, String payType) throws Exception { public void paySuccess(Map<String, String> map, String payType) throws Exception {
log.info("AlipayNotify Test --------> start"); log.info("AlipayNotify Test --------> start");
System.out.println("\nAlipayNotify Test --------> start"); System.out.println("AlipayNotify Test --------> start");
System.out.println("\nAlipayNotify Test --------> done"); System.out.println("AlipayNotify Test --------> done");
log.info("AlipayNotify Test --------> done"); log.info("AlipayNotify Test --------> done");
} }

Loading…
Cancel
Save