From 60a1a3b8815758fbf6e6bd54643c5b3e2e6af8fb Mon Sep 17 00:00:00 2001 From: gongbiao Date: Mon, 10 Sep 2018 20:04:44 +0800 Subject: [PATCH 01/29] =?UTF-8?q?[=E4=BC=9A=E5=91=98][=E4=BF=AE=E6=94=B9][?= =?UTF-8?q?=E5=AF=BC=E5=85=A5]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simple/domain/po/WxCUserBasicInfo.java | 6 ++++ .../impl/WxCUserBasicInfoServiceImpl.java | 33 +++++++++++-------- .../mapper/WxCUserBasicInfoMapper.xml | 12 +++---- 3 files changed, 30 insertions(+), 21 deletions(-) diff --git a/mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java b/mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java index 180948877..0debb147e 100644 --- a/mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java +++ b/mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java @@ -5,6 +5,7 @@ import cn.afterturn.easypoi.excel.annotation.Excel; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Transient; +import javax.validation.constraints.NotNull; import java.io.Serializable; import java.util.Date; import java.util.List; @@ -46,17 +47,21 @@ public class WxCUserBasicInfo implements Serializable { /*微信用户绑定的手机号**/ @Excel(name="手机",width = 20,orderNum = "2") @io.swagger.annotations.ApiModelProperty(value="微信用户绑定的手机号",name="phone") + @NotNull private String phone; /*出生日期**/ @Excel(name="生日",width = 20,format="yyyy-MM-dd",orderNum = "3") + @NotNull @io.swagger.annotations.ApiModelProperty(value="出生日期",name="birthdate") private Date birthdate; /*学历**/ @Excel(name="学历",width = 20,orderNum = "4") + @NotNull @io.swagger.annotations.ApiModelProperty(value="学历",name="education") private String education; /*性别:0:保密 1.男 2女**/ @Excel(name="性别",width = 20,replace = { "保密_0", "男_1","女_2"},orderNum = "2") + @NotNull @io.swagger.annotations.ApiModelProperty(value="性别:0:保密 1.男 2女",name="sex") private Integer sex; /*邮箱**/ @@ -83,6 +88,7 @@ public class WxCUserBasicInfo implements Serializable { /*用户姓名**/ @Excel(name="姓名",width = 20) + @NotNull @io.swagger.annotations.ApiModelProperty(value="用户姓名",name="name") private String name; diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java index 228614175..16efaf807 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java @@ -302,29 +302,36 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { try { ImportParams params = new ImportParams(); - params.setTitleRows(1); - params.setHeadRows(1); + + List datalist = ExcelImportUtil.importExcel(file.getInputStream(),WxCUserBasicInfo.class, params); WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo(); wxCUserBasicInfo.setTenantId(tenantId); List list = wxCUserBasicInfoMapper.findList(wxCUserBasicInfo); final IdWorker idWorker = IdWorker.get(); for(WxCUserBasicInfo user:datalist){ - WxCUserBasicInfo tempuser = list.stream().filter(u -> u.getPhone().equals(user.getPhone())).findFirst().get(); - if(tempuser!=null){ - tempuser.setSex(user.getSex()); - tempuser.setEducation(user.getEducation()); - tempuser.setBirthdate(user.getBirthdate()); - tempuser.setName(user.getName()); - wxCUserBasicInfoMapper.updateByPrimaryKeySelective(tempuser); - } else { - user.setId(idWorker.nextId()); - wxCUserBasicInfoMapper.insertSelective(user); + if(user.getPhone()!=null){ + WxCUserBasicInfo tempuser=null; + if(list.size()>0){ + tempuser = list.stream().filter(u -> u.getPhone().equals(user.getPhone())).findFirst().get(); + } + if(tempuser!=null){ + tempuser.setTenantId(tenantId); + tempuser.setSex(user.getSex()); + tempuser.setEducation(user.getEducation()); + tempuser.setBirthdate(user.getBirthdate()); + tempuser.setName(user.getName()); + wxCUserBasicInfoMapper.updateByPrimaryKeySelective(tempuser); + } else { + user.setId(idWorker.nextId()); + user.setTenantId(tenantId); + wxCUserBasicInfoMapper.insertSelective(user); + } } } } catch (Exception e) { - throw new MallinkException(500,"模板导入失败"); + throw new MallinkException(500,"模板导入失败"+e); } return new ResultData(Result.SUCCESS,"导入成功"); diff --git a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml index d4cefec11..bed2cacd1 100644 --- a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml @@ -32,7 +32,7 @@ - and c.`tenant_id` like concat('%', #{tenantId},'%') + and `tenant_id` = #{tenantId} @@ -67,20 +67,16 @@ and `tag_id` = #{tagId} - - and `c_user_id` = #{cUserId} - - - and c.`create_date` = #{createDate} + and `create_date` = #{createDate} - and c.`update_date` = #{updateDate} + and `update_date` = #{updateDate} - and c.`name` like concat('%', #{name},'%') + and `name` like concat('%', #{name},'%') and id in From 5d58929a9943e3f79ba1d2f21e30c52a2dd6b977 Mon Sep 17 00:00:00 2001 From: gongbiao Date: Tue, 11 Sep 2018 14:43:43 +0800 Subject: [PATCH 02/29] =?UTF-8?q?[=E8=B7=A8=E5=9F=9F][=E6=96=B0=E5=A2=9E][?= =?UTF-8?q?admin=E9=85=8D=E7=BD=AE]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/simple/config/CorsConfig.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 mallinkAdmin/src/main/java/com/simple/config/CorsConfig.java diff --git a/mallinkAdmin/src/main/java/com/simple/config/CorsConfig.java b/mallinkAdmin/src/main/java/com/simple/config/CorsConfig.java new file mode 100644 index 000000000..9fd07bf4e --- /dev/null +++ b/mallinkAdmin/src/main/java/com/simple/config/CorsConfig.java @@ -0,0 +1,22 @@ +package com.simple.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; + +/** + * Created by Administrator on 2017/8/9. + */ +@Configuration +public class CorsConfig extends WebMvcConfigurerAdapter { + + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins("*") + .allowCredentials(true) + .allowedMethods("GET", "POST", "DELETE", "PUT") + .maxAge(3600); + } + +} From 3d6ef53c7453194dec04fc55f2a7873ac57fabe8 Mon Sep 17 00:00:00 2001 From: gongbiao Date: Tue, 11 Sep 2018 14:44:17 +0800 Subject: [PATCH 03/29] =?UTF-8?q?[=E6=95=B0=E6=8D=AE=E5=A1=94=E5=8F=B0][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9][=E4=B8=9A=E5=8A=A1=E9=80=BB=E8=BE=91]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/simple/service/impl/DataTowerServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mallinkService/src/main/java/com/simple/service/impl/DataTowerServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/DataTowerServiceImpl.java index 3e80e330a..b6738057a 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/DataTowerServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/DataTowerServiceImpl.java @@ -93,8 +93,8 @@ public class DataTowerServiceImpl implements DataTowerService { if(payinfo!=null){ BigDecimal receivepay = (BigDecimal) payinfo.get("receivepay"); BigDecimal pay = (BigDecimal) payinfo.get("pay"); - BigDecimal divide = receivepay.divide(pay); - double zjcjl = divide.doubleValue()*100; + BigDecimal divide = receivepay.divide(pay,2, BigDecimal.ROUND_HALF_UP); + double zjcjl = divide.multiply(new BigDecimal(100)).doubleValue(); datamap.put("ysje",receivepay); datamap.put("ssje",pay); datamap.put("zjsjl",zjcjl+"%"); From fde52de9584e67aafa32c162810475b6914b7777 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Tue, 11 Sep 2018 17:03:04 +0800 Subject: [PATCH 04/29] =?UTF-8?q?[msg=E6=B7=BB=E5=8A=A0log][=E6=96=B0?= =?UTF-8?q?=E5=8A=A0]:=E6=96=B0=E5=8A=A0=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/simple/controller/WxMallApplyController.java | 2 +- .../java/com/simple/controller/WxMsgCallbackController.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxMallApplyController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxMallApplyController.java index edfbd6b0b..df034af2c 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxMallApplyController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxMallApplyController.java @@ -59,7 +59,7 @@ public class WxMallApplyController extends BaseController { } - @GetMapping("sendvalidationcode") + @GetMapping("/sendvalidationcode") @ApiImplicitParams({ @ApiImplicitParam(name = "phone", value = "手机号", dataType = "String", paramType = "query", required = true), @ApiImplicitParam(name = "type", value = "场景", dataType = "Integer", paramType = "query", required = true)}) diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxMsgCallbackController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxMsgCallbackController.java index 8fd4a8026..f29eeda95 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxMsgCallbackController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxMsgCallbackController.java @@ -70,6 +70,7 @@ public class WxMsgCallbackController extends BaseController { @RequestMapping(value = "/receivemsg/{bid}") public void receivemsg(@PathVariable String bid, @RequestParam Map param) { + logger.info(param.toString()); //解析param数据插入数据库中 String item = param.get("item"); String sign = param.get("sign"); @@ -80,6 +81,7 @@ public class WxMsgCallbackController extends BaseController { @RequestMapping(value = "/receivemodel/{bid}") public void receivemodel(@PathVariable String bid, @RequestParam Map param) { + logger.info(param.toString()); //解析param数据插入数据库中 wxMsgCallbackService.receivemodel(getTenantId(), bid, param); @@ -87,6 +89,7 @@ public class WxMsgCallbackController extends BaseController { @RequestMapping(value = "/receiveverifymodel/{bid}") public void receiveverifymodel(@PathVariable String bid, @RequestParam Map param) { + logger.info(param.toString()); //解析param数据插入数据库中 wxMsgCallbackService.receiveverifymodel(bid, param); From cb3cd2813b4e1f6d25c70297b655183c47798f3e Mon Sep 17 00:00:00 2001 From: masterspirit Date: Tue, 11 Sep 2018 17:59:13 +0800 Subject: [PATCH 05/29] =?UTF-8?q?[=E5=88=B8=E6=95=B0=E6=8D=AE=E5=88=97?= =?UTF-8?q?=E8=A1=A8][=E4=BF=AE=E6=94=B9]=E6=B7=BB=E5=8A=A0=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E6=9D=A1=E4=BB=B6=E5=88=B8=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/dto/MarkingCouponDataReportDto.java | 9 +++++++++ .../service/impl/MarkingDataReportServiceImpl.java | 4 ++++ .../main/resources/mapper/WxCouponOrderMapper.xml | 14 ++++++++++---- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/mallinkService/src/main/java/com/simple/domain/dto/MarkingCouponDataReportDto.java b/mallinkService/src/main/java/com/simple/domain/dto/MarkingCouponDataReportDto.java index 86c5aa8a3..4f2fb9ef9 100644 --- a/mallinkService/src/main/java/com/simple/domain/dto/MarkingCouponDataReportDto.java +++ b/mallinkService/src/main/java/com/simple/domain/dto/MarkingCouponDataReportDto.java @@ -10,6 +10,7 @@ public class MarkingCouponDataReportDto { private Date startTime; private Date endTime; private Integer type; + private Integer couponType; public Integer getType() { return type; @@ -34,4 +35,12 @@ public class MarkingCouponDataReportDto { public void setEndTime(Date endTime) { this.endTime = endTime; } + + public Integer getCouponType() { + return couponType; + } + + public void setCouponType(Integer couponType) { + this.couponType = couponType; + } } diff --git a/mallinkService/src/main/java/com/simple/service/impl/MarkingDataReportServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/MarkingDataReportServiceImpl.java index ef10a7758..07659fa57 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/MarkingDataReportServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/MarkingDataReportServiceImpl.java @@ -195,6 +195,10 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { params.put("tenantId", tenantId); params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); + if(markingCouponDataReportDto.getCouponType()!=null){ + params.put("couponType", markingCouponDataReportDto.getCouponType()); + } + PageHelper.startPage(pageIndex, pageSize); List couponDatalist = wxCouponOrderMapper.couponDataList(params); if(couponDatalist.isEmpty()){ diff --git a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml index 5aca80900..8ecfc2755 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml @@ -387,11 +387,17 @@ - select from wx_c_user - - - + select + + from wx_c_user + + + + - select * from wx_c_user where `token` = #{token} - - - - - - + + + + + + From 6d79d4dddef540f5d1bb7ab9cceb6c8d97627121 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Wed, 12 Sep 2018 13:54:52 +0800 Subject: [PATCH 09/29] =?UTF-8?q?[=E4=B8=9A=E6=80=81=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D][=E6=96=B0=E5=A2=9E]:=E4=B8=9A=E6=80=81?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/WxCouponChannelMapper.xml | 20 +- .../main/resources/mapper/WxCouponMapper.xml | 521 +++++++++--------- 2 files changed, 254 insertions(+), 287 deletions(-) diff --git a/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml index d5a77dca8..945ee2207 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml @@ -27,71 +27,61 @@ and `id` = #{id} - and `tenant_id` like concat('%', #{tenantId},'%') - and `merchant_id` = #{merchantId} - and `coupon_id` = #{couponId} - and `type` = #{type} - and `title` like concat('%', #{title},'%') - and `target_ad` = #{targetAd} - - - and `business` like concat('%', #{business},'%') + + and JSON_CONTAINS(`business`->'$',JSON_ARRAY('0')) + + + and (JSON_CONTAINS(`business`->'$',JSON_ARRAY('0')) or (JSON_CONTAINS(`business`->'$',JSON_ARRAY(#{business})))) and `begin_time` = #{beginTime} - and `end_time` = #{endTime} - and `status` = #{status} - and `create_date` = #{createDate} - and `update_date` = #{updateDate} - and `sub_target_id` = #{subTargetId} - and id in diff --git a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml index 6e8b40a1b..58e3336e5 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml @@ -1,238 +1,214 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `id`,`tenant_id`,`merchant_id`,`type`,`cover_img`,`title`,`sub_title`,`sale_price`,`use_price`,`use_limit_quantity`,`target_ad`,`send_type`,`valid_type`,`valid_start_date`,`valid_end_date`,`valid_days`,`detail`,`price`,`unit`,`remain_inventory`,`inventory`,`remark`,`status`,`create_date`,`update_date`,`business` - - where 1 = 1 - - - and `id` = #{id} - - - - - and `tenant_id` like concat('%', #{tenantId},'%') - - - - - and `merchant_id` = #{merchantId} - - - - - and `type` = #{type} - - - - - and `cover_img` like concat('%', #{coverImg},'%') - - - - - and `title` like concat('%', #{title},'%') - - - - - and `sub_title` like concat('%', #{subTitle},'%') - - - - - and `sale_price` = #{salePrice} - - - - - and `use_price` = #{usePrice} - - - - - and `use_limit_quantity` = #{useLimitQuantity} - - - - - and `target_ad` = #{targetAd} - - - - - and `send_type` = #{sendType} - - - - - - - and `valid_type` = #{validType} - - - - - and `valid_start_date` = #{validStartDate} - - - - - and `valid_end_date` = #{validEndDate} - - - - - and `valid_days` = #{validDays} - - - - - and `detail` like concat('%', #{detail},'%') - - - - - and `price` = #{price} - - - - - and `unit` = #{unit} - - - - - and `remain_inventory` = #{remainInventory} - - - - - and `inventory` = #{inventory} - - - - - and `remark` like concat('%', #{remark},'%') - - - - - and `status` = #{status} - - - - - and `create_date` = #{createDate} - - - - - and `update_date` = #{updateDate} - - - - - and `business` like concat('%', #{business},'%') - - - - and id in - - #{idItem} - - - order by ${sortColumns} - + + where 1 = 1 + + + and `id` = #{id} + + + + and `tenant_id` like concat('%', #{tenantId},'%') + + + + and `merchant_id` = #{merchantId} + + + + and `type` = #{type} + + + + and `cover_img` like concat('%', #{coverImg},'%') + + + + and `title` like concat('%', #{title},'%') + + + + and `sub_title` like concat('%', #{subTitle},'%') + + + + and `sale_price` = #{salePrice} + + + + and `use_price` = #{usePrice} + + + + and `use_limit_quantity` = #{useLimitQuantity} + + + + and `target_ad` = #{targetAd} + + + + and `send_type` = #{sendType} + + + + + and `valid_type` = #{validType} + + + + and `valid_start_date` = #{validStartDate} + + + + and `valid_end_date` = #{validEndDate} + + + + and `valid_days` = #{validDays} + + + + and `detail` like concat('%', #{detail},'%') + + + and `price` = #{price} + + + and `unit` = #{unit} + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + and `remain_inventory` = #{remainInventory} + + + + and `inventory` = #{inventory} + + + + and `remark` like concat('%', #{remark},'%') + + + + and `status` = #{status} + + + + and `create_date` = #{createDate} + + + + and `update_date` = #{updateDate} + + + + and JSON_CONTAINS(`business`->'$',JSON_ARRAY('0')) + + + and (JSON_CONTAINS(`business`->'$',JSON_ARRAY('0')) or (JSON_CONTAINS(`business`->'$',JSON_ARRAY(#{business})))) + + + and id in + + #{idItem} + + + order by ${sortColumns} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + c.tenant_id,c.merchant_id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.use_limit_quantity,c.target_ad,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.detail,c.price,c.unit,c.remain_inventory,c.inventory,c.remark,c.status,c.create_date,c.update_date,c.business, m.img_url,m.name,m.link_phone,m.status, s.addr,s.shop_number,s.baidu_poi, @@ -241,57 +217,58 @@ - - - - - + + + + c.tenant_id,c.merchant_id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.use_limit_quantity,c.target_ad,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.detail,c.price,c.unit,c.remain_inventory,c.inventory,c.remark,c.status,c.create_date,c.update_date,c.business, m.img_url,m.name,m.link_phone,m.status, s.addr,s.shop_number,s.baidu_poi, mb.building_name,mf.floor_name - - - + + + update wx_coupon SET remain_inventory = remain_inventory - #{number} where id = #{id} and remain_inventory>= #{number} From d36680ec6cdf9b5ed1da6ed8a8fff26fb94f1e2a Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Wed, 12 Sep 2018 14:56:18 +0800 Subject: [PATCH 10/29] =?UTF-8?q?[=E6=88=90=E9=95=BF=E5=80=BC=E7=AE=80?= =?UTF-8?q?=E5=8D=95=E8=AE=A1=E7=AE=97][=E6=96=B0=E5=A2=9E]:=E6=88=90?= =?UTF-8?q?=E9=95=BF=E5=80=BC=E7=AE=80=E5=8D=95=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/simple/service/WxCUserService.java | 7 +++- .../service/impl/WxCUserServiceImpl.java | 41 ++++++++++++++++++- .../service/impl/WxOrderServiceImpl.java | 11 +++++ 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/mallinkService/src/main/java/com/simple/service/WxCUserService.java b/mallinkService/src/main/java/com/simple/service/WxCUserService.java index 4a811283c..067d49d58 100644 --- a/mallinkService/src/main/java/com/simple/service/WxCUserService.java +++ b/mallinkService/src/main/java/com/simple/service/WxCUserService.java @@ -66,11 +66,16 @@ public interface WxCUserService { /** * 通过渠道获取会员信息 - * @param channel + * @param sceneList * @param pageIndex * @param pageSize * @return */ PageInfo listByChannel(List sceneList, Integer pageIndex, Integer pageSize); + + /** + * 计算当前用户成长值 + */ + void scoreCalculate(String tenantId, Long cUserId); } diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxCUserServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxCUserServiceImpl.java index 2aa324dc6..dfb2ea248 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxCUserServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxCUserServiceImpl.java @@ -5,7 +5,11 @@ import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.simple.domain.dto.WxCUserBasicInfoDto; import com.simple.domain.po.WxCUser; +import com.simple.domain.po.WxCouponOrder; +import com.simple.domain.po.WxScoreRules; import com.simple.mapper.WxCUserMapper; +import com.simple.mapper.WxCouponOrderMapper; +import com.simple.mapper.WxScoreRulesMapper; import com.simple.service.WxCUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -17,6 +21,12 @@ public class WxCUserServiceImpl implements WxCUserService { @Autowired WxCUserMapper wxCUserMapper; + @Autowired + WxCouponOrderMapper wxCouponOrderMapper; + + @Autowired + WxScoreRulesMapper wxScoreRulesMapper; + @Override public PageInfo listAsPage(WxCUser record, Integer pageIndex, Integer pageSize) { @@ -75,7 +85,36 @@ public class WxCUserServiceImpl implements WxCUserService { } - + @Override + public void scoreCalculate(String tenantId, Long cUserId) { + // login count + int login_count = 0; + WxCUser user = wxCUserMapper.selectByPrimaryKey(cUserId); + if (user != null) { + login_count = user.getLoginCount(); + } + // coupon order + WxCouponOrder couponOrder = new WxCouponOrder(); + couponOrder.setTenantId(tenantId); + couponOrder.setCUserId(cUserId); + int counponCount = wxCouponOrderMapper.selectCount(couponOrder); + + // score rule + WxScoreRules scoreRuleQ = new WxScoreRules(); + scoreRuleQ.setTenantId(tenantId); + WxScoreRules scoreRules = wxScoreRulesMapper.selectOne(scoreRuleQ); + if (scoreRules != null) { + Integer score = + (login_count / scoreRules.getLoginCount()) * scoreRules.getLoginScoreNumber() + + (counponCount / scoreRules.getConsumptionScoreNumber()) * scoreRules.getConsumptionAmount(); + if (user != null) { + user.setScore(score); + user.setUpdateDate(new Date()); + wxCUserMapper.updateByPrimaryKeySelective(user); + } + } + + } diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxOrderServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxOrderServiceImpl.java index 2aac9638d..435146565 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxOrderServiceImpl.java @@ -12,6 +12,7 @@ import com.simple.domain.vo.WxOrderCVo; import com.simple.enums.*; import com.simple.exception.MallinkException; import com.simple.mapper.*; +import com.simple.service.WxCUserService; import com.simple.service.WxOrderService; import com.simple.utils.RedisLock; import org.apache.log4j.Logger; @@ -56,6 +57,9 @@ public class WxOrderServiceImpl implements WxOrderService { @Autowired WxCouponOrderMapper wxCouponOrderMapper; + @Autowired + WxCUserService wxCUserService; + @Override public PageInfo listAsPage(WxOrder record, Integer pageIndex, Integer pageSize) { return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxOrderMapper.findList(record)); @@ -497,6 +501,13 @@ public class WxOrderServiceImpl implements WxOrderService { logger.error("保存订单:" + e.getMessage()); throw new MallinkException(ErrorCode.COUPON_ORDER_SAVE_ERR); } + + // 成长值 计算 + try { + wxCUserService.scoreCalculate(user.getTenantId(), user.getId()); + } catch (Exception e) { + logger.error("成长值:" + e.getMessage()); + } return ret; } From cebac4130d6e00fc3062195b1434ee1f8072681e Mon Sep 17 00:00:00 2001 From: gongbiao Date: Wed, 12 Sep 2018 12:50:28 +0800 Subject: [PATCH 11/29] =?UTF-8?q?[=E6=A0=87=E7=AD=BE=E7=9F=AD=E4=BF=A1][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9][=E5=9B=9E=E8=B0=83]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WxMsgCallbackController.java | 18 +++++++++--------- .../service/impl/WxMsgCallbackServiceImpl.java | 10 ++++++---- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxMsgCallbackController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxMsgCallbackController.java index de54b6af3..087048924 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxMsgCallbackController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxMsgCallbackController.java @@ -68,29 +68,29 @@ public class WxMsgCallbackController extends BaseController { } - @PostMapping(value = "/receivemsg/{bid}") - public void receivemsg(@PathVariable String bid, @RequestParam Map param) { + @PostMapping(value = "/receivemsg/{tenantId}") + public void receivemsg(@PathVariable String tenantId, @RequestParam Map param) { logger.info(param.toString()); //解析param数据插入数据库中 String item = param.get("item"); String sign = param.get("sign"); - wxMsgCallbackService.saveOrUpdate(bid, item, sign); + wxMsgCallbackService.saveOrUpdate(tenantId, item, sign); } - @RequestMapping(value = "/receivemodel/{bid}") - public void receivemodel(@PathVariable String bid, @RequestParam Map param) { + @RequestMapping(value = "/receivemodel/{tenantId}") + public void receivemodel(@PathVariable String tenantId, @RequestParam Map param) { logger.info(param.toString()); //解析param数据插入数据库中 - wxMsgCallbackService.receivemodel(bid, param); + wxMsgCallbackService.receivemodel(tenantId, param); } - @RequestMapping(value = "/receiveverifymodel/{bid}") - public void receiveverifymodel(@PathVariable String bid, @RequestParam Map param) { + @RequestMapping(value = "/receiveverifymodel/{tenantId}") + public void receiveverifymodel(@PathVariable String tenantId, @RequestParam Map param) { logger.info(param.toString()); //解析param数据插入数据库中 - wxMsgCallbackService.receiveverifymodel(bid, param); + wxMsgCallbackService.receiveverifymodel(tenantId, param); } diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxMsgCallbackServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxMsgCallbackServiceImpl.java index cbc8ba41a..f8afbcb90 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxMsgCallbackServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxMsgCallbackServiceImpl.java @@ -63,10 +63,10 @@ public class WxMsgCallbackServiceImpl implements WxMsgCallbackService { } @Override - public void saveOrUpdate(String bid, String item, String sign) { + public void saveOrUpdate(String tenantId, String item, String sign) { WxMsgConfig wxMsgConfig = new WxMsgConfig(); - wxMsgConfig.setBid(bid); + wxMsgConfig.setTenantId(tenantId); List list = wxMsgConfigMapper.findList(wxMsgConfig); List wxMsgCallbacks = JSONArray.parseArray(item, WxMsgCallback.class); wxMsgConfig = list.get(0); @@ -83,10 +83,11 @@ public class WxMsgCallbackServiceImpl implements WxMsgCallbackService { } @Override - public void receivemodel(String bid, Map param) { + public void receivemodel(String tenantId, Map param) { WxMsgModel wxMsgModel = new WxMsgModel(); wxMsgModel.setModelId(Integer.valueOf(param.get("id"))); + wxMsgModel.setTenantId(tenantId); wxMsgModel = wxMsgModelMapper.findList(wxMsgModel).get(0); wxMsgModel.setStatus(param.get("status").equals("1")?Integer.valueOf(param.get("status")):0); wxMsgModelMapper.updateByPrimaryKeySelective(wxMsgModel); @@ -95,10 +96,11 @@ public class WxMsgCallbackServiceImpl implements WxMsgCallbackService { } @Override - public void receiveverifymodel(String bid, Map param) { + public void receiveverifymodel(String tenantId, Map param) { WxMsgValidationcodeModel wxMsgModel = new WxMsgValidationcodeModel(); wxMsgModel.setModelId(Integer.valueOf(param.get("id"))); + wxMsgModel.setTenantId(tenantId); wxMsgModel = wxMsgValidationcodeModelMapper.findList(wxMsgModel).get(0); wxMsgModel.setStatus(param.get("status").equals("1")?Integer.valueOf(param.get("status")):0); wxMsgValidationcodeModelMapper.updateByPrimaryKeySelective(wxMsgModel); From b1e16bf50b4eb4bd4f2940ab010defd3b1eac228 Mon Sep 17 00:00:00 2001 From: gongbiao Date: Wed, 12 Sep 2018 15:15:39 +0800 Subject: [PATCH 12/29] =?UTF-8?q?[=E4=BC=9A=E5=91=98=E7=AE=A1=E7=90=86][?= =?UTF-8?q?=E4=BC=9A=E5=91=98=E8=AF=A6=E6=83=85][=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E5=AF=BC=E5=87=BA]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/WxCUserBasicInfoServiceImpl.java | 109 +++++++++++++++++- .../mapper/WxCUserBasicInfoMapper.xml | 13 +-- 2 files changed, 112 insertions(+), 10 deletions(-) diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java index 16efaf807..ededb7edb 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java @@ -28,8 +28,11 @@ import javax.servlet.http.HttpServletResponse; import java.io.*; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.UUID; +import static java.util.stream.Collectors.toList; + @Service public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { @@ -101,7 +104,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxCUserBasicInfoMapper.findListMap(record)); } - @Override + /*@Override public void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId) { @@ -221,8 +224,110 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { } - } + }*/ + + public void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId) { + + + WxCUser wxCUser = new WxCUser(); + wxCUser.setTenantId(tenantId); + List userlist = wxCUserMapper.findList(wxCUser); + WxCUserBasicInfo basicInfo = new WxCUserBasicInfo(); + basicInfo.setTenantId(tenantId); + List memberlist = wxCUserBasicInfoMapper.findList(basicInfo); + + XSSFWorkbook workbook; + String filepath = "./uploads/"; + File savefile = new File(filepath); + if (!savefile.exists()) { + savefile.mkdirs(); + } + String filename = UUID.randomUUID() + ".xlsx"; + filepath = filepath + filename; + try { + File file = new File(filepath); + workbook = new XSSFWorkbook(); + + XSSFSheet sheetOne = workbook.createSheet("会员"); + Row row = sheetOne.createRow(0); + Cell nameCell = row.createCell(0); + Cell phoneCell = row.createCell(1); + Cell nickNameCell = row.createCell(2); + Cell cityCell = row.createCell(3); + Cell provinceCell = row.createCell(4); + Cell countryCodeCell = row.createCell(5); + Cell registerIpCell = row.createCell(6); + Cell emailCell = row.createCell(7); + Cell educationCell = row.createCell(8); + Cell addressCell = row.createCell(9); + Cell activeTimeCell = row.createCell(10); + Cell registerTimeCell = row.createCell(11); + + nameCell.setCellValue("姓名"); + phoneCell.setCellValue("手机号"); + nickNameCell.setCellValue("微信名称"); + cityCell.setCellValue("城市"); + provinceCell.setCellValue("省份"); + countryCodeCell.setCellValue("国家代码"); + registerIpCell.setCellValue("注册IP"); + emailCell.setCellValue("邮箱"); + educationCell.setCellValue("学历"); + addressCell.setCellValue("地址"); + activeTimeCell.setCellValue("上次活跃时间"); + registerTimeCell.setCellValue("注册时间"); + + for (int i = 0; i < memberlist.size(); i++) { + row = sheetOne.createRow(i + 1); + nameCell = row.createCell(0); + phoneCell = row.createCell(1); + nickNameCell = row.createCell(2); + cityCell = row.createCell(3); + provinceCell = row.createCell(4); + countryCodeCell = row.createCell(5); + registerIpCell = row.createCell(6); + emailCell = row.createCell(7); + educationCell = row.createCell(8); + addressCell = row.createCell(9); + activeTimeCell = row.createCell(10); + registerTimeCell = row.createCell(11); + + WxCUserBasicInfo wxCUserBasicInfo = memberlist.get(0); + nameCell.setCellValue(wxCUserBasicInfo.getName()); + String phone = wxCUserBasicInfo.getPhone(); + phoneCell.setCellValue(phone); + emailCell.setCellValue(wxCUserBasicInfo.getEmail()); + educationCell.setCellValue(wxCUserBasicInfo.getEducation()); + addressCell.setCellValue(wxCUserBasicInfo.getAddress()); + Optional first = userlist.stream().filter(m -> { + if(m.getPhone() != null){ + return m.getPhone().equals(phone); + } + return false; + }).findFirst(); + if(first.isPresent()){ + WxCUser cUser = first.get(); + nickNameCell.setCellValue(cUser.getNickName()); + countryCodeCell.setCellValue(cUser.getCountryCode()); + cityCell.setCellValue(cUser.getCity()); + provinceCell.setCellValue(cUser.getProvince()); + registerIpCell.setCellValue(cUser.getRegisterIp()); + activeTimeCell.setCellValue(cUser.getUpdateDate()); + registerTimeCell.setCellValue(cUser.getCreateDate()); + } + + } + + FileOutputStream fileOut = new FileOutputStream(file); + workbook.write(fileOut); + fileOut.close(); + workbook.close(); + downFile(filepath, filename, response, request); + FileUtils.forceDelete(file); + } catch (Exception e) { + e.printStackTrace(); + } + } public void downFile(String filePath,String filename, HttpServletResponse response, HttpServletRequest req) throws IOException { diff --git a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml index bed2cacd1..7522c7a90 100644 --- a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml @@ -163,24 +163,21 @@ From bbb8a85d9d13656eba305fa020c5d74176a01810 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Wed, 12 Sep 2018 18:59:02 +0800 Subject: [PATCH 13/29] =?UTF-8?q?[=E5=90=8E=E5=8F=B0=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E7=A0=81][=E6=96=B0=E5=A2=9E]:=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E7=A0=81=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/simple/config/KaptchaConfig.java | 32 ++++++++++ .../java/com/simple/config/ShiroConfig.java | 1 + .../com/simple/controller/HomeController.java | 47 ++++++++++++-- .../java/com/simple/utils/ShiroUtils.java | 61 +++++++++++++++++++ .../java/com/simple/common/ErrorCode.java | 2 + pom.xml | 6 ++ 6 files changed, 144 insertions(+), 5 deletions(-) create mode 100644 mallinkAdmin/src/main/java/com/simple/config/KaptchaConfig.java create mode 100644 mallinkAdmin/src/main/java/com/simple/utils/ShiroUtils.java diff --git a/mallinkAdmin/src/main/java/com/simple/config/KaptchaConfig.java b/mallinkAdmin/src/main/java/com/simple/config/KaptchaConfig.java new file mode 100644 index 000000000..39a36e9c6 --- /dev/null +++ b/mallinkAdmin/src/main/java/com/simple/config/KaptchaConfig.java @@ -0,0 +1,32 @@ +package com.simple.config; + +import com.google.code.kaptcha.impl.DefaultKaptcha; +import com.google.code.kaptcha.util.Config; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.util.Properties; + + +/** + * 生成验证码配置 + * + * @author stormeye.wu + * @email wugq@mippoint.com + * @date 2017-04-20 19:22 + */ +@Configuration +public class KaptchaConfig { + + @Bean + public DefaultKaptcha producer() { + Properties properties = new Properties(); + properties.put("kaptcha.border", "no"); + properties.put("kaptcha.textproducer.font.color", "black"); + properties.put("kaptcha.textproducer.char.space", "5"); + Config config = new Config(properties); + DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); + defaultKaptcha.setConfig(config); + return defaultKaptcha; + } +} diff --git a/mallinkAdmin/src/main/java/com/simple/config/ShiroConfig.java b/mallinkAdmin/src/main/java/com/simple/config/ShiroConfig.java index 70edeaaf7..948d3b637 100644 --- a/mallinkAdmin/src/main/java/com/simple/config/ShiroConfig.java +++ b/mallinkAdmin/src/main/java/com/simple/config/ShiroConfig.java @@ -120,6 +120,7 @@ public class ShiroConfig { filterChainDefinitionMap.put("/carCallback/**","anon"); filterChainDefinitionMap.put("/wxMallApply/add","anon"); filterChainDefinitionMap.put("/wxMallApply/sendvalidationcode","anon"); + filterChainDefinitionMap.put("/captcha.jpg", "anon"); // filterChainDefinitionMap.put("/role/**", "corsFilter,token"); filterChainDefinitionMap.put("/**", "corsFilter,token,authc"); // filterChainDefinitionMap.put("/**", "anon"); diff --git a/mallinkAdmin/src/main/java/com/simple/controller/HomeController.java b/mallinkAdmin/src/main/java/com/simple/controller/HomeController.java index d737fa627..e44428563 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/HomeController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/HomeController.java @@ -1,6 +1,9 @@ package com.simple.controller; import com.github.pagehelper.PageInfo; +import com.google.code.kaptcha.Constants; +import com.google.code.kaptcha.Producer; +import com.simple.common.ErrorCode; import com.simple.common.ResultData; import com.simple.domain.po.MallRolePermission; import com.simple.domain.po.MallUserInfo; @@ -8,8 +11,10 @@ import com.simple.domain.po.MallUserRole; import com.simple.service.MallRolePermissionService; import com.simple.service.MallUserRoleService; import com.simple.shiro.UserSession; +import com.simple.utils.ShiroUtils; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.apache.commons.io.IOUtils; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.UsernamePasswordToken; import org.apache.shiro.subject.Subject; @@ -17,10 +22,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.StringUtils; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; + +import javax.imageio.ImageIO; +import javax.servlet.ServletException; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.awt.image.BufferedImage; +import java.io.IOException; @RestController @@ -28,15 +37,43 @@ import org.springframework.web.bind.annotation.RestController; public class HomeController { private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + private Producer producer; + @Autowired private MallUserRoleService mallUserRoleService; @Autowired private MallRolePermissionService mallRolePermissionService; + @RequestMapping("/captcha.jpg") + public void captcha(HttpServletResponse response)throws ServletException, IOException { + response.setHeader("Cache-Control", "no-store, no-cache"); + response.setContentType("image/jpeg"); + + //生成文字验证码 + String text = producer.createText(); + //生成图片验证码 + BufferedImage image = producer.createImage(text); + //保存到shiro session + ShiroUtils.setSessionAttribute(Constants.KAPTCHA_SESSION_KEY, text); + + ServletOutputStream out = response.getOutputStream(); + ImageIO.write(image, "jpg", out); + IOUtils.closeQuietly(out); + } + @ApiOperation("登录") @PostMapping("/doLogin") - public ResultData login(@RequestBody MallUserInfo user) { + public ResultData login(@RequestBody MallUserInfo user, String captcha) { + if (captcha != null) { + String kaptcha = ShiroUtils.getKaptcha(Constants.KAPTCHA_SESSION_KEY); + if(!captcha.equalsIgnoreCase(kaptcha)){ + return new ResultData(ErrorCode.KAPCHA_NOT_EQUAL); + } + } + ResultData data = new ResultData(); if (StringUtils.isEmpty(user.getUsername()) || StringUtils.isEmpty(user.getPassword())) { // throw new SystemException(ErrorCode.LOGIN_USER_OR_PWD_ERROR); diff --git a/mallinkAdmin/src/main/java/com/simple/utils/ShiroUtils.java b/mallinkAdmin/src/main/java/com/simple/utils/ShiroUtils.java new file mode 100644 index 000000000..810ba5eb2 --- /dev/null +++ b/mallinkAdmin/src/main/java/com/simple/utils/ShiroUtils.java @@ -0,0 +1,61 @@ +package com.simple.utils; + +import com.simple.common.ErrorCode; +import com.simple.domain.po.MallUserInfo; +import com.simple.exception.MallinkException; +import com.simple.shiro.UserSession; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.session.Session; +import org.apache.shiro.subject.Subject; + +/** + * Shiro工具类 + * + * @author stormeye.wu + * @email wugq@mippoint.com + * @date 2016年11月12日 上午9:49:19 + */ +public class ShiroUtils { + + public static Session getSession() { + return SecurityUtils.getSubject().getSession(); + } + + public static Subject getSubject() { + return SecurityUtils.getSubject(); + } + + public static MallUserInfo getUserInfo() { + return (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); + } + + public static Long getUserId() { + return getUserInfo().getId(); + } + + public static void setSessionAttribute(Object key, Object value) { + getSession().setAttribute(key, value); + } + + public static Object getSessionAttribute(Object key) { + return getSession().getAttribute(key); + } + + public static boolean isLogin() { + return SecurityUtils.getSubject().getPrincipal() != null; + } + + public static void logout() { + SecurityUtils.getSubject().logout(); + } + + public static String getKaptcha(String key) { + Object kaptcha = getSessionAttribute(key); + if (kaptcha == null) { + throw new MallinkException(ErrorCode.KAPCHA_NOT_VALID); + } + getSession().removeAttribute(key); + return kaptcha.toString(); + } + +} diff --git a/mallinkService/src/main/java/com/simple/common/ErrorCode.java b/mallinkService/src/main/java/com/simple/common/ErrorCode.java index 129aa18d9..39f119743 100644 --- a/mallinkService/src/main/java/com/simple/common/ErrorCode.java +++ b/mallinkService/src/main/java/com/simple/common/ErrorCode.java @@ -54,6 +54,8 @@ public enum ErrorCode{ USER_IS_LOCKED(2003, "用户已经被锁定不能登录,请与管理员联系"), NEW_USER_FAILD(2004, "创建新用户失败"), BUSER_NOT_IN_APP(2005, "用户不是此app用户"), + KAPCHA_NOT_VALID(2006, "验证码已失效"), + KAPCHA_NOT_EQUAL(2007, "验证码不正确"), /** * 商场/商户 diff --git a/pom.xml b/pom.xml index c59cd5ab1..a9c890591 100644 --- a/pom.xml +++ b/pom.xml @@ -222,6 +222,12 @@ 2.8.5 + + com.github.axet + kaptcha + 0.0.9 + + com.github.binarywang weixin-java-miniapp From 6a296d5e3a9ffabbab07db1612adca9bff765bfc Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Wed, 12 Sep 2018 19:48:04 +0800 Subject: [PATCH 14/29] =?UTF-8?q?[=E6=88=90=E9=95=BF=E5=80=BC][=E6=96=B0?= =?UTF-8?q?=E5=A2=9E]:=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E6=88=90=E9=95=BF=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/simple/controller/WxUserGrantController.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java b/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java index e1be4ca28..502d12574 100755 --- a/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java +++ b/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java @@ -121,7 +121,6 @@ public class WxUserGrantController extends BaseController { user.setLongitude(BigDecimal.valueOf(Double.valueOf(longitude))); if (!StringUtils.isBlank(latitude)) user.setLatitude(BigDecimal.valueOf(Double.valueOf(latitude))); - // TODO 成长值 wxCUserService.saveOrUpdate(user1); resultMap.put("token", token); } else { @@ -136,7 +135,6 @@ public class WxUserGrantController extends BaseController { user.setLongitude(BigDecimal.valueOf(Double.valueOf(longitude))); if (!StringUtils.isBlank(latitude)) user.setLatitude(BigDecimal.valueOf(Double.valueOf(latitude))); - // TODO 成长值 wxCUserService.saveOrUpdate(user); resultMap.put("token", token); } @@ -144,6 +142,9 @@ public class WxUserGrantController extends BaseController { logger.error(e.getMessage()); return new ResultData(ErrorCode.DB_FAIL.getCode(), "wx_c_user数据库保存出错", resultMap); } + + // 成长值 + wxCUserService.scoreCalculate(user.getTenantId(), user.getId()); return new ResultData(resultMap); } From 5ebe1f80d4673ec8f2287fb6c274ef4dc37e00d4 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Wed, 12 Sep 2018 19:48:41 +0800 Subject: [PATCH 15/29] =?UTF-8?q?[=E6=88=90=E9=95=BF=E5=80=BC][=E6=96=B0?= =?UTF-8?q?=E5=A2=9E]:=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E6=88=90=E9=95=BF=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/simple/controller/WxUserGrantController.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java b/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java index 502d12574..f120442d0 100755 --- a/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java +++ b/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java @@ -144,7 +144,12 @@ public class WxUserGrantController extends BaseController { } // 成长值 - wxCUserService.scoreCalculate(user.getTenantId(), user.getId()); + try { + wxCUserService.scoreCalculate(user.getTenantId(), user.getId()); + } catch (Exception e) { + logger.error(e.getMessage()); + } + return new ResultData(resultMap); } From 991b21a822367325511c0852c814bce96d229d44 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Wed, 12 Sep 2018 20:51:20 +0800 Subject: [PATCH 16/29] =?UTF-8?q?[=E7=94=A8=E6=88=B7ID=E5=90=8C=E6=AD=A5][?= =?UTF-8?q?=E6=96=B0=E5=A2=9E]:=E7=94=A8=E6=88=B7=E6=89=8B=E6=9C=BA?= =?UTF-8?q?=E7=9B=B8=E5=90=8C=E6=97=B6=E5=90=8C=E6=AD=A5ID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WxUserGrantController.java | 19 +++++++++- .../com/simple/domain/vo/CUserBaseVo.java | 20 +++++++++++ .../simple/mapper/WxCUserBasicInfoMapper.java | 3 ++ .../service/WxCUserBasicInfoService.java | 36 ++++++++++++------- .../impl/WxCUserBasicInfoServiceImpl.java | 21 ++++++++--- .../mapper/WxCUserBasicInfoMapper.xml | 6 +++- 6 files changed, 87 insertions(+), 18 deletions(-) create mode 100644 mallinkService/src/main/java/com/simple/domain/vo/CUserBaseVo.java diff --git a/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java b/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java index f120442d0..c50f099b1 100755 --- a/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java +++ b/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java @@ -14,8 +14,10 @@ import com.simple.common.Result; import com.simple.common.ResultData; import com.simple.domain.po.WxAppinfo; import com.simple.domain.po.WxCUser; +import com.simple.domain.po.WxCUserBasicInfo; import com.simple.domain.po.WxCUserCar; import com.simple.service.WxAppinfoService; +import com.simple.service.WxCUserBasicInfoService; import com.simple.service.WxCUserCarService; import com.simple.service.WxCUserService; import com.simple.utils.CheckUtil; @@ -51,6 +53,9 @@ public class WxUserGrantController extends BaseController { @Autowired private WxCUserService wxCUserService; + @Autowired + private WxCUserBasicInfoService wxCUserBasicInfoService; + @Autowired private WxCUserCarService wxCUserCarService; @@ -249,7 +254,6 @@ public class WxUserGrantController extends BaseController { wxCUserService.saveOrUpdate(user); resultMap.put("msg","授权手机成功!"); resultMap.put("phone",phoneNoInfo.getPhoneNumber()); - return new ResultData(resultMap); } else { return new ResultData(ErrorCode.PHONE_DECODE_ERR, resultMap); } @@ -257,6 +261,19 @@ public class WxUserGrantController extends BaseController { this.logger.error(e.getMessage(), e); return new ResultData(ErrorCode.DB_FAIL.getCode(), "解密并保存出错", resultMap); } + + // update wx_c_user_basic_info + List list = wxCUserBasicInfoService.findByPhone(user.getTenantId(), user.getPhone()); + if (list.size() > 0) { + WxCUserBasicInfo basicInfo = list.get(0); + try { + wxCUserBasicInfoService.updateObj(basicInfo, user.getId()); + } catch (Exception e) { + + } + } + + return new ResultData(resultMap); } /** diff --git a/mallinkService/src/main/java/com/simple/domain/vo/CUserBaseVo.java b/mallinkService/src/main/java/com/simple/domain/vo/CUserBaseVo.java new file mode 100644 index 000000000..e7693f1ec --- /dev/null +++ b/mallinkService/src/main/java/com/simple/domain/vo/CUserBaseVo.java @@ -0,0 +1,20 @@ +package com.simple.domain.vo; + + +import com.simple.domain.po.WxCUserBasicInfo; + +/** + * Created by syf on 2018/8/30. + */ +public class CUserBaseVo extends WxCUserBasicInfo { + + private Long newId; + + public Long getNewId() { + return newId; + } + + public void setNewId(Long newId) { + this.newId = newId; + } +} diff --git a/mallinkService/src/main/java/com/simple/mapper/WxCUserBasicInfoMapper.java b/mallinkService/src/main/java/com/simple/mapper/WxCUserBasicInfoMapper.java index 11c5ef83f..9253f7268 100644 --- a/mallinkService/src/main/java/com/simple/mapper/WxCUserBasicInfoMapper.java +++ b/mallinkService/src/main/java/com/simple/mapper/WxCUserBasicInfoMapper.java @@ -3,6 +3,7 @@ package com.simple.mapper; import com.simple.common.CommonMapper; import com.simple.domain.dto.WxCUserBasicInfoDto; import com.simple.domain.po.WxCUserBasicInfo; +import com.simple.domain.vo.CUserBaseVo; import java.util.List; import java.util.Map; @@ -16,6 +17,8 @@ public interface WxCUserBasicInfoMapper extends CommonMapper list(WxCUserBasicInfoDto record); void updateScore(WxCUserBasicInfo record); + + void updateNewId(CUserBaseVo record); long findCountBySex(WxCUserBasicInfoDto dto); diff --git a/mallinkService/src/main/java/com/simple/service/WxCUserBasicInfoService.java b/mallinkService/src/main/java/com/simple/service/WxCUserBasicInfoService.java index b8adeacbd..616d50da8 100644 --- a/mallinkService/src/main/java/com/simple/service/WxCUserBasicInfoService.java +++ b/mallinkService/src/main/java/com/simple/service/WxCUserBasicInfoService.java @@ -8,11 +8,12 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.util.List; import java.util.Map; public interface WxCUserBasicInfoService { - /** + /** * 根据实体查询分页列表 * * @param record @@ -20,53 +21,64 @@ public interface WxCUserBasicInfoService { * @param limit * @return */ - PageInfo listAsPage(WxCUserBasicInfo record, Integer pageIndex, Integer pageSize); - - /** + PageInfo listAsPage(WxCUserBasicInfo record, Integer pageIndex, Integer pageSize); + + /** * 根据Id获得实体 * * @param id * @return */ WxCUserBasicInfo getById(Long id); - - /** + + /** * 保存或更新实体 * * @param record */ void saveOrUpdate(WxCUserBasicInfo record); + /** + * 保存或更新实体 + * + * @param record + */ + void updateObj(WxCUserBasicInfo record, Long newId); + /** * 根据Id删除实体 * * @param id */ void deleteById(Long id); - - - + + PageInfo list(WxCUserBasicInfoDto record, Integer pageIndex, Integer pageSize); + List findByPhone(String tenantId, String phone); + /** * 修改会员积分 + * * @param record */ void updateScore(WxCUserBasicInfo record); /** - * 根据性别查询数量 - * @param sex + * 根据性别查询数量 + * + * @param dto * @return */ long findCountBySex(WxCUserBasicInfoDto dto); /** * 根据年龄查询数量 + * * @param dto * @return */ - long findCountByAge(WxCUserBasicInfoDto dto); + long findCountByAge(WxCUserBasicInfoDto dto); PageInfo> queryListMap(WxCUserBasicInfoDto wxCUserBasicInfo, Integer pageNum, Integer pageSize); diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java index ededb7edb..aaffd8b5e 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java @@ -10,6 +10,7 @@ import com.simple.common.ResultData; import com.simple.domain.dto.WxCUserBasicInfoDto; import com.simple.domain.po.WxCUser; import com.simple.domain.po.WxCUserBasicInfo; +import com.simple.domain.vo.CUserBaseVo; import com.simple.exception.MallinkException; import com.simple.mapper.WxCUserBasicInfoMapper; import com.simple.mapper.WxCUserMapper; @@ -54,13 +55,18 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserBasicInfoMapper.list(record)); } + @Override + public List findByPhone(String tenantId, String phone) { + WxCUserBasicInfo basicQ = new WxCUserBasicInfo(); + basicQ.setTenantId(tenantId); + basicQ.setPhone(phone); + return wxCUserBasicInfoMapper.select(basicQ); + } + @Override public void updateScore(WxCUserBasicInfo record) { wxCUserBasicInfoMapper.updateScore(record); - } - - @Override public WxCUserBasicInfo getById(Long id) { @@ -79,6 +85,14 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { } } + @Override + public void updateObj(WxCUserBasicInfo record, Long newId) { + CUserBaseVo userBaseVo = new CUserBaseVo(); + org.springframework.beans.BeanUtils.copyProperties(record, userBaseVo); + userBaseVo.setNewId(newId); + wxCUserBasicInfoMapper.updateNewId(userBaseVo); + } + @Override public void deleteById(Long id) { wxCUserBasicInfoMapper.deleteByPrimaryKey(id); @@ -88,7 +102,6 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { @Override public long findCountBySex(WxCUserBasicInfoDto dto) { - return wxCUserBasicInfoMapper.findCountBySex(dto); } diff --git a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml index 7522c7a90..81e153bff 100644 --- a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml @@ -129,8 +129,12 @@ update wx_c_user_basic_info set poins=#{poins} where phone=#{phone} and tenant_id=#{tenantId} - and c_user_id=#{cUserId} + and id=#{cUserId} + + + update wx_c_user_basic_info set id=#{newId} where tenant_id=#{tenantId} + and id = #{id} - select - - from wx_c_user c - left join wx_c_user_basic_info cb on cb.id = c.id and cb.tenant_id = c.tenant_id - where 1=1 - - and c.`tenant_id` = #{tenantId} - - - and c.`phone` = #{phone} - - - and c.`phone` is not null - - - and cb.create_date >= #{startTime} - - - - and cb.update_date <= #{endTime} - - - - and cb.`name` like concat('%', #{name},'%') - - update wx_c_user_basic_info set poins=#{poins} where phone=#{phone} and tenant_id=#{tenantId} and id=#{cUserId} @@ -164,36 +136,5 @@ and birthdate <= #{birthEndTime} - - - From 815429bbb00267c4ed6c809bbf883de371ed07ce Mon Sep 17 00:00:00 2001 From: gongbiao Date: Thu, 13 Sep 2018 16:54:59 +0800 Subject: [PATCH 24/29] =?UTF-8?q?[=E6=A0=87=E7=AD=BE=E7=9F=AD=E4=BF=A1][?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF][=E6=9F=A5=E8=AF=A2=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mallinkService/src/main/resources/mapper/WxMsgModelMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mallinkService/src/main/resources/mapper/WxMsgModelMapper.xml b/mallinkService/src/main/resources/mapper/WxMsgModelMapper.xml index 28b2cbbdd..18e993090 100644 --- a/mallinkService/src/main/resources/mapper/WxMsgModelMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxMsgModelMapper.xml @@ -30,7 +30,7 @@ - + and `name` = #{name} From eea644ca21908a74bdcb20845fcac664a49cfda7 Mon Sep 17 00:00:00 2001 From: hupeng Date: Thu, 13 Sep 2018 18:55:58 +0800 Subject: [PATCH 25/29] =?UTF-8?q?[C=E7=AB=AF][=E4=BF=AE=E6=94=B9]:?= =?UTF-8?q?=E5=88=B8=E5=88=97=E8=A1=A8=E4=B8=8D=E8=83=BD=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simple/domain/vo/WxCouponOrderCVo.java | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/mallinkService/src/main/java/com/simple/domain/vo/WxCouponOrderCVo.java b/mallinkService/src/main/java/com/simple/domain/vo/WxCouponOrderCVo.java index 28c7e2a19..ff70154ef 100644 --- a/mallinkService/src/main/java/com/simple/domain/vo/WxCouponOrderCVo.java +++ b/mallinkService/src/main/java/com/simple/domain/vo/WxCouponOrderCVo.java @@ -321,26 +321,26 @@ public class WxCouponOrderCVo extends WxCouponOrder{ public static enum Field { Id_ASC("`id` ASC"), Id_DESC("`id` DESC"), - TenantId_ASC("`tenantId` ASC"), - TenantId_DESC("`tenantId` DESC"), - CouponId_ASC("`couponId` ASC"), - CouponId_DESC("`couponId` DESC"), - CUserId_ASC("`cUserId` ASC"), - CUserId_DESC("`cUserId` DESC"), - BUserId_ASC("`bUserId` ASC"), - BUserId_DESC("`bUserId` DESC"), - OrderId_ASC("`orderId` ASC"), - OrderId_DESC("`orderId` DESC"), - ExpiredTime_ASC("`expiredTime` ASC"), - ExpiredTime_DESC("`expiredTime` DESC"), - CouponOrderStatus_ASC("`couponOrderStatus` ASC"), - CouponOrderStatus_DESC("`couponOrderStatus` DESC"), - CreateDate_ASC("`createDate` ASC"), - CreateDate_DESC("`createDate` DESC"), - UpdateDate_ASC("`updateDate` ASC"), - UpdateDate_DESC("`updateDate` DESC"), - CouponPrice_ASC("`couponPrice` ASC"), - CouponPrice_DESC("`couponPrice` DESC"); + TenantId_ASC("`tenant_id` ASC"), + TenantId_DESC("`tenant_id` DESC"), + CouponId_ASC("`coupon_id` ASC"), + CouponId_DESC("`coupon_id` DESC"), + CUserId_ASC("`c_user_id` ASC"), + CUserId_DESC("`c_user_id` DESC"), + BUserId_ASC("`b_user_id` ASC"), + BUserId_DESC("`b_user_id` DESC"), + OrderId_ASC("`order_id` ASC"), + OrderId_DESC("`order_id` DESC"), + ExpiredTime_ASC("`expired_time` ASC"), + ExpiredTime_DESC("`expired_time` DESC"), + CouponOrderStatus_ASC("`coupon_order_status` ASC"), + CouponOrderStatus_DESC("`coupon_order_status` DESC"), + CreateDate_ASC("`create_date` ASC"), + CreateDate_DESC("`create_date` DESC"), + UpdateDate_ASC("`update_date` ASC"), + UpdateDate_DESC("`update_date` DESC"), + CouponPrice_ASC("`coupon_price` ASC"), + CouponPrice_DESC("`coupon_price` DESC"); private String value; Field(String value) { @@ -376,6 +376,7 @@ public class WxCouponOrderCVo extends WxCouponOrder{ sb.append(fields[k].toString()); } + this.sortColumns = sb.toString(); } public void setSortColumns(String sortColumns) { From 881ecba43868c830ed22e7d9f2816f556d37bbc0 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Thu, 13 Sep 2018 18:56:41 +0800 Subject: [PATCH 26/29] =?UTF-8?q?[=E4=BC=9A=E5=91=98=E4=BF=A1=E6=81=AF][?= =?UTF-8?q?=E9=87=8D=E6=95=B4]:=E4=BC=9A=E5=91=98=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E9=87=8D=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simple/domain/po/WxCUserBasicInfo.java | 12 ++- .../impl/WxCUserBasicInfoServiceImpl.java | 75 +++++++++++++------ 2 files changed, 62 insertions(+), 25 deletions(-) diff --git a/mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java b/mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java index 9ad94f356..9778c5564 100644 --- a/mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java +++ b/mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java @@ -44,17 +44,17 @@ public class WxCUserBasicInfo implements Serializable { /**微信用户绑定的手机号**/ - @Excel(name="手机",width = 20,orderNum = "2") + @Excel(name="手机号",width = 20,orderNum = "3") @io.swagger.annotations.ApiModelProperty(value="微信用户绑定的手机号",name="phone") @NotNull private String phone; /**出生日期**/ - @Excel(name="生日",width = 20,format="yyyy-MM-dd",orderNum = "3") + @Excel(name="生日",width = 20,format="yyyy-MM-dd",orderNum = "6") @NotNull @io.swagger.annotations.ApiModelProperty(value="出生日期",name="birthdate") private Date birthdate; /**学历**/ - @Excel(name="学历",width = 20,orderNum = "4") + @Excel(name="学历",width = 20,orderNum = "5") @NotNull @io.swagger.annotations.ApiModelProperty(value="学历",name="education") private String education; @@ -67,6 +67,7 @@ public class WxCUserBasicInfo implements Serializable { @io.swagger.annotations.ApiModelProperty(value="邮箱",name="email") private String email; /**地址**/ + @Excel(name="地址",width = 20,orderNum = "7") @io.swagger.annotations.ApiModelProperty(value="地址",name="address") private String address; /**积分**/ @@ -76,9 +77,11 @@ public class WxCUserBasicInfo implements Serializable { @io.swagger.annotations.ApiModelProperty(value="用户标签",name="tagId") private Long tagId; /**创建时间**/ + @Excel(name="注册时间",width = 20,format="yyyy-MM-dd", orderNum = "9") @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") private Date createDate; /**更新时间**/ + @Excel(name="上次活跃时间",width = 20,format="yyyy-MM-dd", orderNum = "8") @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") private Date updateDate; /**租户id**/ @@ -86,7 +89,7 @@ public class WxCUserBasicInfo implements Serializable { private String tenantId; /**用户姓名**/ - @Excel(name="姓名",width = 20) + @Excel(name="姓名",width = 20,orderNum = "1") @NotNull @io.swagger.annotations.ApiModelProperty(value="用户姓名",name="name") private String name; @@ -95,6 +98,7 @@ public class WxCUserBasicInfo implements Serializable { @io.swagger.annotations.ApiModelProperty(value="会员等级",name="level") private String level; /**用户昵称**/ + @Excel(name="微信昵称",width = 20,orderNum = "4") @io.swagger.annotations.ApiModelProperty(value="用户昵称",name="nickName") private String nickName; diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java index fa9b7a669..6b556183b 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java @@ -29,6 +29,7 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.*; +import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import java.util.Map; @@ -117,40 +118,62 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { } String filename = UUID.randomUUID() + ".xlsx"; filepath = filepath + filename; + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + try { File file = new File(filepath); workbook = new XSSFWorkbook(); XSSFSheet sheetTwo = workbook.createSheet("会员信息"); Row rowtwo = sheetTwo.createRow(0); Cell nameCellTwo = rowtwo.createCell(0); - Cell phoneCellTwo = rowtwo.createCell(1); - Cell sexCellTwo = rowtwo.createCell(2); - Cell birthdateCellTwo = rowtwo.createCell(3); + Cell sexCellTwo = rowtwo.createCell(1); + Cell phoneCellTwo = rowtwo.createCell(2); + Cell nickNameCellTwo = rowtwo.createCell(3); Cell educationCellTwo = rowtwo.createCell(4); - + Cell birthdateCellTwo = rowtwo.createCell(5); + Cell addrCellTwo = rowtwo.createCell(6); + Cell updateDateCellTwo = rowtwo.createCell(7); + Cell createDateCellTwo = rowtwo.createCell(8); nameCellTwo.setCellValue("姓名"); - phoneCellTwo.setCellValue("手机"); sexCellTwo.setCellValue("性别"); - birthdateCellTwo.setCellValue("生日"); + phoneCellTwo.setCellValue("手机号"); + nickNameCellTwo.setCellValue("微信昵称"); educationCellTwo.setCellValue("学历"); - + birthdateCellTwo.setCellValue("生日"); + addrCellTwo.setCellValue("地址"); + updateDateCellTwo.setCellValue("上次活跃时间"); + createDateCellTwo.setCellValue("注册时间"); for (int i = 0; i < memberlist.size(); i++) { rowtwo = sheetTwo.createRow(i + 1); nameCellTwo = rowtwo.createCell(0); - phoneCellTwo = rowtwo.createCell(1); - sexCellTwo = rowtwo.createCell(2); - birthdateCellTwo = rowtwo.createCell(3); + sexCellTwo = rowtwo.createCell(1); + phoneCellTwo = rowtwo.createCell(2); + nickNameCellTwo = rowtwo.createCell(3); educationCellTwo = rowtwo.createCell(4); + birthdateCellTwo = rowtwo.createCell(5); + addrCellTwo = rowtwo.createCell(6); + updateDateCellTwo = rowtwo.createCell(7); + createDateCellTwo = rowtwo.createCell(8); WxCUserBasicInfo entity = memberlist.get(i); + String sexStr = "保密"; + if (entity.getSex() == 1) + sexStr = "男"; + else if (entity.getSex() == 2) + sexStr = "女"; nameCellTwo.setCellValue(entity.getName()); + sexCellTwo.setCellValue(sexStr); phoneCellTwo.setCellValue(entity.getPhone()); - sexCellTwo.setCellValue(entity.getSex()); - birthdateCellTwo.setCellValue(entity.getBirthdate()); + nickNameCellTwo.setCellValue(entity.getNickName()); educationCellTwo.setCellValue(entity.getEducation()); + birthdateCellTwo.setCellValue(entity.getBirthdate()); + addrCellTwo.setCellValue(entity.getAddress()); + updateDateCellTwo.setCellValue(sdf.format(entity.getUpdateDate())); + createDateCellTwo.setCellValue(sdf.format(entity.getCreateDate())); } @@ -212,17 +235,26 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { XSSFSheet sheetTwo = workbook.createSheet("会员信息"); Row rowtwo = sheetTwo.createRow(0); + Cell nameCellTwo = rowtwo.createCell(0); - Cell phoneCellTwo = rowtwo.createCell(1); - Cell sexCellTwo = rowtwo.createCell(2); - Cell birthdateCellTwo = rowtwo.createCell(3); + Cell sexCellTwo = rowtwo.createCell(1); + Cell phoneCellTwo = rowtwo.createCell(2); + Cell nickNameCellTwo = rowtwo.createCell(3); Cell educationCellTwo = rowtwo.createCell(4); + Cell birthdateCellTwo = rowtwo.createCell(5); + Cell addrCellTwo = rowtwo.createCell(6); + Cell updateDateCellTwo = rowtwo.createCell(7); + Cell createDateCellTwo = rowtwo.createCell(8); nameCellTwo.setCellValue("姓名"); - phoneCellTwo.setCellValue("手机"); sexCellTwo.setCellValue("性别"); - birthdateCellTwo.setCellValue("生日"); + phoneCellTwo.setCellValue("手机号"); + nickNameCellTwo.setCellValue("微信昵称"); educationCellTwo.setCellValue("学历"); + birthdateCellTwo.setCellValue("生日"); + addrCellTwo.setCellValue("地址"); + updateDateCellTwo.setCellValue("上次活跃时间"); + createDateCellTwo.setCellValue("注册时间"); FileOutputStream fileOut = new FileOutputStream(file); workbook.write(fileOut); @@ -260,16 +292,17 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { if (oldUserBase != null) { oldUserBase.setTenantId(tenantId); + oldUserBase.setName(userBase.getName()); oldUserBase.setSex(userBase.getSex()); + oldUserBase.setNickName(userBase.getNickName()); oldUserBase.setEducation(userBase.getEducation()); oldUserBase.setBirthdate(userBase.getBirthdate()); - oldUserBase.setName(userBase.getName()); - oldUserBase.setUpdateDate(curDate); + oldUserBase.setAddress(userBase.getAddress()); + oldUserBase.setUpdateDate(userBase.getUpdateDate()); + oldUserBase.setCreateDate(userBase.getCreateDate()); } else { userBase.setId(idWorker.nextId()); userBase.setTenantId(tenantId); - userBase.setCreateDate(curDate); - userBase.setUpdateDate(curDate); } // update 昵称 From 5f6e4df331303f7b4c3e044979145afd99490688 Mon Sep 17 00:00:00 2001 From: hupeng Date: Thu, 13 Sep 2018 19:23:00 +0800 Subject: [PATCH 27/29] =?UTF-8?q?[B=E7=AB=AF][=E4=BF=AE=E6=94=B9]:?= =?UTF-8?q?=E5=88=B8=E5=88=97=E8=A1=A8=E4=B8=8D=E8=83=BD=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simple/domain/vo/WxCouponOrderBVo.java | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/mallinkService/src/main/java/com/simple/domain/vo/WxCouponOrderBVo.java b/mallinkService/src/main/java/com/simple/domain/vo/WxCouponOrderBVo.java index a26dfe9f7..ff306e2ab 100644 --- a/mallinkService/src/main/java/com/simple/domain/vo/WxCouponOrderBVo.java +++ b/mallinkService/src/main/java/com/simple/domain/vo/WxCouponOrderBVo.java @@ -218,26 +218,26 @@ public class WxCouponOrderBVo extends WxCouponOrder{ public static enum Field { Id_ASC("`id` ASC"), Id_DESC("`id` DESC"), - TenantId_ASC("`tenantId` ASC"), - TenantId_DESC("`tenantId` DESC"), - CouponId_ASC("`couponId` ASC"), - CouponId_DESC("`couponId` DESC"), - CUserId_ASC("`cUserId` ASC"), - CUserId_DESC("`cUserId` DESC"), - BUserId_ASC("`bUserId` ASC"), - BUserId_DESC("`bUserId` DESC"), - OrderId_ASC("`orderId` ASC"), - OrderId_DESC("`orderId` DESC"), - ExpiredTime_ASC("`expiredTime` ASC"), - ExpiredTime_DESC("`expiredTime` DESC"), - CouponOrderStatus_ASC("`couponOrderStatus` ASC"), - CouponOrderStatus_DESC("`couponOrderStatus` DESC"), - CreateDate_ASC("`createDate` ASC"), - CreateDate_DESC("`createDate` DESC"), - UpdateDate_ASC("`updateDate` ASC"), - UpdateDate_DESC("`updateDate` DESC"), - CouponPrice_ASC("`couponPrice` ASC"), - CouponPrice_DESC("`couponPrice` DESC"); + TenantId_ASC("`tenant_id` ASC"), + TenantId_DESC("`tenant_id` DESC"), + CouponId_ASC("`coupon_id` ASC"), + CouponId_DESC("`coupon_id` DESC"), + CUserId_ASC("`c_user_id` ASC"), + CUserId_DESC("`c_user_id` DESC"), + BUserId_ASC("`b_user_id` ASC"), + BUserId_DESC("`b_user_id` DESC"), + OrderId_ASC("`order_id` ASC"), + OrderId_DESC("`order_id` DESC"), + ExpiredTime_ASC("`expired_time` ASC"), + ExpiredTime_DESC("`expired_time` DESC"), + CouponOrderStatus_ASC("`coupon_order_status` ASC"), + CouponOrderStatus_DESC("`coupon_order_status` DESC"), + CreateDate_ASC("`create_date` ASC"), + CreateDate_DESC("`create_date` DESC"), + UpdateDate_ASC("`update_date` ASC"), + UpdateDate_DESC("`update_date` DESC"), + CouponPrice_ASC("`coupon_price` ASC"), + CouponPrice_DESC("`coupon_price` DESC"); private String value; Field(String value) { @@ -273,6 +273,7 @@ public class WxCouponOrderBVo extends WxCouponOrder{ sb.append(fields[k].toString()); } + this.sortColumns = sb.toString(); } public void setSortColumns(String sortColumns) { From b480d8f26d0dc9ef423014ff6480c5e6c021979d Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Fri, 14 Sep 2018 10:54:29 +0800 Subject: [PATCH 28/29] =?UTF-8?q?[B=E7=AB=AF=E5=BC=80=E5=90=AF=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E6=B6=88=E6=81=AF][=E6=96=B0=E5=A2=9E]:=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E6=B6=88=E6=81=AF=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simple/controller/WxMallController.java | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/mallinkBApi/src/main/java/com/simple/controller/WxMallController.java b/mallinkBApi/src/main/java/com/simple/controller/WxMallController.java index c09ce7b34..a60032b66 100644 --- a/mallinkBApi/src/main/java/com/simple/controller/WxMallController.java +++ b/mallinkBApi/src/main/java/com/simple/controller/WxMallController.java @@ -16,8 +16,13 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.PrintWriter; import java.util.HashMap; import java.util.Map; @@ -69,4 +74,34 @@ public class WxMallController extends BaseController { } + /** + * 微信消息服务验证 + * @param response + * @param request + * @throws IOException + */ + @AuthIgnore + @RequestMapping(value = "/signature") + @ResponseBody + public void signature(HttpServletResponse response, HttpServletRequest request) throws IOException { + + + String signature = request.getParameter("signature"); + String timestamp = request.getParameter("timestamp"); + String nonce = request.getParameter("nonce"); + String echostr = request.getParameter("echostr"); + + logger.warn("收到的微信服务验证信息:"+signature+"\n"+timestamp+"\n"+nonce+"\n"+echostr); + PrintWriter out = response.getWriter(); + // 通过检验signature对请求进行校验,若校验成功则原样返回echostr,表示接入成功,否则接入失败 + // 当前无法确定此消息的appId及token, 所以直接返回echostr + //if (CheckUtil.checkSignature(wp.getToken(), signature, timestamp, nonce)) { + out.print(echostr); + logger.warn("微信服务验证成功===================="+echostr); + System.out.println("微信服务验证成功!"); + //} + out.close(); + } + + } From 68a16fafceb9484d985ad154a4fea58b3f18d9a5 Mon Sep 17 00:00:00 2001 From: gongbiao Date: Fri, 14 Sep 2018 13:05:48 +0800 Subject: [PATCH 29/29] =?UTF-8?q?[=E8=90=A5=E9=94=80=E7=B3=BB=E7=BB=9F][?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=AE=A1=E7=90=86][=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E6=97=B6=E4=BA=A4=E6=98=93=E6=97=B6=E9=97=B4=E5=B8=A6=E6=97=B6?= =?UTF-8?q?=E5=88=86=E7=A7=92]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/simple/domain/vo/WxCouponOrderBVo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mallinkService/src/main/java/com/simple/domain/vo/WxCouponOrderBVo.java b/mallinkService/src/main/java/com/simple/domain/vo/WxCouponOrderBVo.java index ff306e2ab..a2e98de72 100644 --- a/mallinkService/src/main/java/com/simple/domain/vo/WxCouponOrderBVo.java +++ b/mallinkService/src/main/java/com/simple/domain/vo/WxCouponOrderBVo.java @@ -69,7 +69,7 @@ public class WxCouponOrderBVo extends WxCouponOrder{ @io.swagger.annotations.ApiModelProperty(value = "状态:0,待使用 1,已核销 2,已过期 3,已作废 ", name = "couponOrderStatus") private Integer couponOrderStatus; /***/ - @Excel(name="交易时间",width = 20,exportFormat="yyyy-MM-dd",orderNum = "3") + @Excel(name="交易时间",width = 20,exportFormat="yyyy-MM-dd HH:mm:ss",orderNum = "3") @io.swagger.annotations.ApiModelProperty(value = "", name = "createDate") private Date createDate; /***/