| @@ -117,6 +117,7 @@ public class ShiroConfig { | |||
| // } | |||
| // } | |||
| filterChainDefinitionMap.put("/swagger-ui.html","anon"); | |||
| filterChainDefinitionMap.put("/wxPay/notify/**", "anon"); | |||
| filterChainDefinitionMap.put("/v2/**","anon"); | |||
| filterChainDefinitionMap.put("/swagger-resources/**","anon"); | |||
| filterChainDefinitionMap.put("/webjars/**","anon"); | |||
| @@ -0,0 +1,100 @@ | |||
| package com.simple.controller; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.CouponInject; | |||
| import com.simple.service.CouponInjectService; | |||
| import com.simple.service.WxCUserTagsService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @Api(description = "精准投放接口") | |||
| @RestController | |||
| @RequestMapping("couponInject") | |||
| public class CouponInjectController extends BaseController | |||
| { | |||
| @Autowired | |||
| private CouponInjectService couponInjectService; | |||
| @Autowired | |||
| private WxCUserTagsService wxCUserTagsService; | |||
| private Logger logger = Logger.getLogger(CouponInjectController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute CouponInject couponInject, Integer pageNum, Integer pageSize) { | |||
| if (null == couponInject) couponInject = new CouponInject(); | |||
| if(couponInject.getStatus()!=null&&couponInject.getStatus()==-1){ | |||
| couponInject.setStatus(null); | |||
| } | |||
| final PageInfo<CouponInject> page = couponInjectService.listAsPage(couponInject, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody CouponInject couponInject) { | |||
| couponInject.setTenantId(getUser().getTenantId()); | |||
| couponInject.setMUserId(getUser().getId()); | |||
| if(couponInject.getSendType()==0){ | |||
| couponInject.setSendTime(new Date()); | |||
| } | |||
| //Assert.notNull(couponInject.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| couponInjectService.add(couponInject); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody CouponInject couponInject) { | |||
| String[] arys = couponInject.getTags().split(","); | |||
| List<Long> tagids = new ArrayList<>(); | |||
| for (int i = 0; i < arys.length; i++) { | |||
| tagids.add(Long.parseLong(arys[i])); | |||
| } | |||
| couponInject.setTags(JSON.toJSONString(arys)); | |||
| couponInjectService.saveOrUpdate(couponInject); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData delete(Long id) { | |||
| couponInjectService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData findById(Long id) { | |||
| CouponInject couponInject = couponInjectService.getById(id); | |||
| if(couponInject!=null) { | |||
| List<Long> tagids = JSON.parseArray(couponInject.getTags(), Long.class); | |||
| couponInject.setWxChooseTagVo(wxCUserTagsService.findChooseTag(tagids)); | |||
| } | |||
| return new ResultData(Result.SUCCESS,"查询成功",couponInject); | |||
| } | |||
| } | |||
| @@ -1,5 +1,8 @@ | |||
| package com.simple.controller; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -11,13 +14,16 @@ import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxCUserBasicInfo; | |||
| import com.simple.domain.po.WxCUserTags; | |||
| import com.simple.domain.po.WxTags; | |||
| import com.simple.service.WxCUserBasicInfoService; | |||
| import com.simple.service.WxCUserTagsService; | |||
| import com.simple.service.WxTagsService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| @@ -34,6 +40,9 @@ public class WxCUserBasicInfoController extends BaseController | |||
| @Autowired | |||
| private WxCUserTagsService wxCUserTagsService; | |||
| @Autowired | |||
| private WxTagsService wxTagsService; | |||
| private Logger logger = Logger.getLogger(WxCUserBasicInfoController.class); | |||
| @@ -66,7 +75,17 @@ public class WxCUserBasicInfoController extends BaseController | |||
| WxCUserTags record =new WxCUserTags(); | |||
| record.setUserId(wxCUserBasicInfo.getcUserId()); | |||
| record.setTenantId(getTenantId()); | |||
| record.setTags(JSON.toJSONString(wxCUserBasicInfo.getTags())); | |||
| PageInfo<WxCUserTags> page = wxCUserTagsService.listAsPage(record, 1, 1); | |||
| if(page.getSize()>0) { | |||
| WxCUserTags t = page.getList().get(0); | |||
| record.setId(t.getId()); | |||
| } | |||
| String tags = wxCUserBasicInfo.getTags(); | |||
| List<Long> tagIdList = new ArrayList<>(); | |||
| for(String t:tags.split(",")) { | |||
| tagIdList.add(Long.valueOf(t)); | |||
| } | |||
| record.setTags(JSON.toJSONString(tagIdList)); | |||
| wxCUserTagsService.saveOrUpdate(record); | |||
| wxCUserBasicInfo.setTagId(record.getId()); | |||
| } | |||
| @@ -86,9 +105,21 @@ public class WxCUserBasicInfoController extends BaseController | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxCUserBasicInfoService.getById(id)); | |||
| WxCUserBasicInfo info = wxCUserBasicInfoService.getById(id); | |||
| if(info.getTagId()!=null) { | |||
| WxCUserTags uTag = wxCUserTagsService.getById(id); | |||
| if(StringUtils.isNotBlank(uTag.getTags())) { | |||
| List<Long> ids = JSONObject.parseArray(uTag.getTags(),Long.class); | |||
| WxTags wxTags =new WxTags(); | |||
| wxTags.setIds(ids); | |||
| PageInfo<WxTags> page = wxTagsService.listAsPage(wxTags, 1, 5000); | |||
| if(page.getSize()>0) { | |||
| info.setTagList(page.getList()); | |||
| } | |||
| } | |||
| } | |||
| return new ResultData(Result.SUCCESS,"查询成功",info); | |||
| } | |||
| } | |||
| @@ -0,0 +1,130 @@ | |||
| package com.simple.controller; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxCampaign; | |||
| import com.simple.domain.po.WxCoupon; | |||
| import com.simple.service.WxCampaignService; | |||
| import com.simple.service.WxCouponService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import static com.simple.domain.po.WxCampaign.Field.SortNum_ASC; | |||
| @RestController | |||
| @RequestMapping("wxCampaign") | |||
| @Api(description="促销和banner接口") | |||
| public class WxCampaignController extends BaseController | |||
| { | |||
| @Autowired | |||
| private WxCampaignService wxCampaignService; | |||
| @Autowired | |||
| private WxCouponService wxCouponService; | |||
| private Logger logger = Logger.getLogger(WxCampaignController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxCampaign wxCampaign, Integer pageNum, Integer pageSize) { | |||
| if (null == wxCampaign) wxCampaign = new WxCampaign(); | |||
| if(wxCampaign.getStatus()!=null&&wxCampaign.getStatus()==-1){ | |||
| wxCampaign.setStatus(null); | |||
| } | |||
| wxCampaign.setTenantId(getTenantId()); | |||
| wxCampaign.setSortColumns(SortNum_ASC); | |||
| final PageInfo<WxCampaign> page = wxCampaignService.listAsPage(wxCampaign, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCampaign wxCampaign) { | |||
| //Assert.notNull(wxCampaign.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| // int sortNum = wxCampaignService.getMaxSortNum(getTenantId()); | |||
| if(StringUtils.isNotBlank(wxCampaign.getCouponIds())) { | |||
| String[] arys = wxCampaign.getCouponIds().split(","); | |||
| wxCampaign.setCouponIds(JSON.toJSONString(arys)); | |||
| } | |||
| wxCampaign.setTenantId(getTenantId()); | |||
| // wxCampaign.setSortNum(sortNum+1); | |||
| wxCampaignService.saveOrUpdate(wxCampaign); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxCampaign wxCampaign) { | |||
| if(StringUtils.isNotBlank(wxCampaign.getCouponIds())) { | |||
| String[] arys = wxCampaign.getCouponIds().split(","); | |||
| wxCampaign.setCouponIds(JSON.toJSONString(arys)); | |||
| } | |||
| wxCampaignService.saveOrUpdate(wxCampaign); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData delete(Long id) { | |||
| wxCampaignService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData findById(Long id) { | |||
| WxCampaign wxCampaign = wxCampaignService.getById(id); | |||
| if (wxCampaign != null) { | |||
| List<Long> list = new ArrayList<>(); | |||
| List<String> templist = JSON.parseArray(wxCampaign.getCouponIds(), String.class); | |||
| for (String temp : templist | |||
| ) { | |||
| list.add(Long.parseLong(temp)); | |||
| } | |||
| WxCoupon wxCoupon = new WxCoupon(); | |||
| wxCoupon.setTenantId(getTenantId()); | |||
| wxCoupon.setIds(list); | |||
| wxCoupon.setStatus(1); | |||
| List<WxCoupon> couponlist = wxCouponService.findList(wxCoupon); | |||
| wxCampaign.setCoupons(couponlist); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxCampaign); | |||
| } | |||
| @ApiOperation("调整顺序") | |||
| @GetMapping("/move") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="sourceId",value="",dataType="Long", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="targetId",value="",dataType="Long", paramType = "query",required=true)}) | |||
| public ResultData move(Long sourceId,Long targetId) { | |||
| WxCampaign source = wxCampaignService.getById(sourceId); | |||
| WxCampaign target = wxCampaignService.getById(targetId); | |||
| if(source==null||target==null){ | |||
| return new ResultData(Result.ERROR, "调整顺序失败", null); | |||
| } | |||
| int temp =source.getSortNum(); | |||
| source.setSortNum(target.getSortNum()); | |||
| target.setSortNum(temp); | |||
| wxCampaignService.saveOrUpdate(source); | |||
| wxCampaignService.saveOrUpdate(target); | |||
| return new ResultData(Result.SUCCESS, "调整顺序成功", null); | |||
| } | |||
| } | |||
| @@ -38,15 +38,15 @@ public class WxMerchantBUserController extends BaseController | |||
| //Assert.notNull(wxMerchantBUser.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxMerchantBUser.setTenantId(getTenantId()); | |||
| wxMerchantBUserService.saveOrUpdate(wxMerchantBUser); | |||
| return new ResultData(); | |||
| Long id = wxMerchantBUserService.saveOrUpdate(wxMerchantBUser); | |||
| return new ResultData(Result.SUCCESS,"添加成功",id); | |||
| } | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxMerchantBUser wxMerchantBUser) { | |||
| wxMerchantBUserService.saveOrUpdate(wxMerchantBUser); | |||
| return new ResultData(); | |||
| Long id = wxMerchantBUserService.saveOrUpdate(wxMerchantBUser); | |||
| return new ResultData(Result.SUCCESS,"更新成功",id); | |||
| } | |||
| @ApiOperation("根据id删除接口") | |||
| @@ -63,7 +63,23 @@ public class WxMerchantBUserController extends BaseController | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxMerchantBUserService.getById(id)); | |||
| } | |||
| @ApiOperation("手机号是否存在") | |||
| @GetMapping("/hasphone") | |||
| @ApiImplicitParam(name="phone",value="phone",dataType="String", paramType = "query",required=true) | |||
| public ResultData hasphone(String phone) { | |||
| boolean has=wxMerchantBUserService.hasphone(phone); | |||
| return new ResultData(Result.SUCCESS,"查询成功",has); | |||
| } | |||
| @ApiOperation("修改密码") | |||
| @GetMapping("/updatepwd") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="phone",value="手机号",dataType="String", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="code",value="验证码",dataType="String", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pwd",value="密码",dataType="String", paramType = "query",required=true)}) | |||
| public ResultData updatepwd(String phone,String code,String pwd) { | |||
| return wxMerchantBUserService.updatepwd(phone,code,pwd); | |||
| } | |||
| } | |||
| @@ -12,27 +12,36 @@ import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.List; | |||
| @RestController | |||
| @RequestMapping("wxMerchant") | |||
| public class WxMerchantController extends BaseController | |||
| { | |||
| @Autowired | |||
| public class WxMerchantController extends BaseController { | |||
| @Autowired | |||
| private WxMerchantService wxMerchantService; | |||
| private Logger logger = Logger.getLogger(WxMerchantController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxMerchant wxMerchant,Integer pageNum, Integer pageSize) { | |||
| if (null == wxMerchant) wxMerchant = new WxMerchant(); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxMerchant wxMerchant, Integer pageNum, Integer pageSize) { | |||
| if (null == wxMerchant) wxMerchant = new WxMerchant(); | |||
| final PageInfo<WxMerchant> page = wxMerchantService.listAsPage(wxMerchant, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("ETCP商户列表") | |||
| @GetMapping("etcplist") | |||
| public ResultData etcpList(@ModelAttribute WxMerchant wxMerchant) { | |||
| if (null == wxMerchant) wxMerchant = new WxMerchant(); | |||
| final List<WxMerchant> merchantList = wxMerchantService.etcpList(wxMerchant); | |||
| return new ResultData(merchantList); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxMerchant wxMerchant) { | |||
| //Assert.notNull(wxMerchant.getName(), "角色名不能为空"); | |||
| @@ -51,25 +60,25 @@ public class WxMerchantController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxMerchantService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxMerchantService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxMerchantService.getById(id)); | |||
| } | |||
| @ApiOperation("停用") | |||
| @GetMapping("disable") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData disable(Long id) { | |||
| wxMerchantService.disable(id); | |||
| return new ResultData(Result.SUCCESS,"停用成功"); | |||
| return new ResultData(Result.SUCCESS, "停用成功"); | |||
| } | |||
| } | |||
| @@ -74,5 +74,19 @@ public class WxMsgCallbackController extends BaseController | |||
| wxMsgCallbackService.saveOrUpdate(bid,item,sign); | |||
| } | |||
| @RequestMapping(value = "/receivemodel/{bid}") | |||
| public void receivemodel(@PathVariable String bid, @RequestParam Map<String,String> param) { | |||
| //解析param数据插入数据库中 | |||
| wxMsgCallbackService.receivemodel(bid,param); | |||
| } | |||
| @RequestMapping(value = "/receiveverifymodel/{bid}") | |||
| public void receiveverifymodel(@PathVariable String bid, @RequestParam Map<String,String> param) { | |||
| //解析param数据插入数据库中 | |||
| wxMsgCallbackService.receiveverifymodel(bid,param); | |||
| } | |||
| } | |||
| @@ -44,6 +44,7 @@ public class WxMsgController extends BaseController | |||
| public ResultData add(@RequestBody WxMsg wxMsg) { | |||
| //Assert.notNull(wxMsg.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxMsg.setTenantId(getTenantId()); | |||
| wxMsgService.saveOrUpdate(wxMsg); | |||
| return new ResultData(); | |||
| } | |||
| @@ -37,6 +37,7 @@ public class WxMsgModelController extends BaseController | |||
| public ResultData add(@RequestBody WxMsgModel wxMsgModel) { | |||
| //Assert.notNull(wxMsgModel.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxMsgModel.setTenantId(getTenantId()); | |||
| return wxMsgModelService.saveOrUpdate(wxMsgModel); | |||
| } | |||
| @@ -65,7 +66,7 @@ public class WxMsgModelController extends BaseController | |||
| @ApiOperation("获取所有数据") | |||
| @GetMapping("getmodellist") | |||
| public ResultData getmodellist() { | |||
| return wxMsgModelService.getmodellist(); | |||
| return wxMsgModelService.getmodellist(getTenantId()); | |||
| } | |||
| @@ -61,29 +61,33 @@ public class WxMsgValidationcodeController extends BaseController | |||
| @GetMapping("sendvalidationcode") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="tenantId",value="租户ID",dataType="String", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="tenantId",value="租户ID",dataType="String", paramType = "query"), | |||
| @ApiImplicitParam(name="phone",value="手机号",dataType="String", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="type",value="场景",dataType="Integer", paramType = "query",required=true)}) | |||
| public ResultData sendvalidationcode(String tenantId,String phone,Integer type) { | |||
| @ApiImplicitParam(name="type",value="场景",dataType="Integer", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="appid",value="appid",dataType="String", paramType = "query",required=true)}) | |||
| public ResultData sendvalidationcode(String tenantId,String phone,Integer type,String appid) { | |||
| WxMsgValidationcode wxMsgValidationcode =new WxMsgValidationcode(); | |||
| wxMsgValidationcode.setTenantId(tenantId); | |||
| wxMsgValidationcode.setPhone(phone); | |||
| wxMsgValidationcode.setType(type); | |||
| wxMsgValidationcode.setAppid(appid); | |||
| return wxMsgValidationcodeService.sendvalidationcode(wxMsgValidationcode); | |||
| } | |||
| @GetMapping("hasvalidationcode") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="tenantId",value="租户ID",dataType="String", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="tenantId",value="租户ID",dataType="String", paramType = "query"), | |||
| @ApiImplicitParam(name="phone",value="手机号",dataType="String", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="type",value="场景",dataType="Integer", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="code",value="验证码",dataType="String", paramType = "query",required=true)}) | |||
| public ResultData hasvalidationcode(String tenantId,String phone,Integer type,String code) { | |||
| @ApiImplicitParam(name="code",value="验证码",dataType="String", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="appid",value="appid",dataType="String", paramType = "query",required=true)}) | |||
| public ResultData hasvalidationcode(String tenantId,String phone,Integer type,String code,String appid) { | |||
| WxMsgValidationcode wxMsgValidationcode =new WxMsgValidationcode(); | |||
| wxMsgValidationcode.setTenantId(tenantId); | |||
| wxMsgValidationcode.setPhone(phone); | |||
| wxMsgValidationcode.setType(type); | |||
| wxMsgValidationcode.setCode(code); | |||
| wxMsgValidationcode.setAppid(appid); | |||
| return wxMsgValidationcodeService.hasvalidationcode(wxMsgValidationcode); | |||
| } | |||
| @@ -0,0 +1,62 @@ | |||
| package com.simple.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxMsgValidationcodeModel; | |||
| import com.simple.service.WxMsgValidationcodeModelService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxMsgValidationcodeModel") | |||
| public class WxMsgValidationcodeModelController extends BaseController | |||
| { | |||
| @Autowired | |||
| private WxMsgValidationcodeModelService wxMsgValidationcodeModelService; | |||
| private Logger logger = Logger.getLogger(WxMsgValidationcodeModelController.class); | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxMsgValidationcodeModel wxMsgValidationcodeModel,Integer pageNum, Integer pageSize) { | |||
| if (null == wxMsgValidationcodeModel) wxMsgValidationcodeModel = new WxMsgValidationcodeModel(); | |||
| final PageInfo<WxMsgValidationcodeModel> page = wxMsgValidationcodeModelService.listAsPage(wxMsgValidationcodeModel, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxMsgValidationcodeModel wxMsgValidationcodeModel) { | |||
| //Assert.notNull(wxMsgValidationcodeModel.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| return wxMsgValidationcodeModelService.saveOrUpdate(wxMsgValidationcodeModel); | |||
| } | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxMsgValidationcodeModel wxMsgValidationcodeModel) { | |||
| wxMsgValidationcodeModelService.saveOrUpdate(wxMsgValidationcodeModel); | |||
| return new ResultData(); | |||
| } | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="String", paramType = "query",required=true) | |||
| public ResultData delete(String id) { | |||
| wxMsgValidationcodeModelService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="String", paramType = "query",required=true) | |||
| public ResultData findById(String id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxMsgValidationcodeModelService.getById(id)); | |||
| } | |||
| } | |||
| @@ -16,9 +16,11 @@ import javax.servlet.http.HttpServletRequest; | |||
| import java.nio.charset.Charset; | |||
| import java.util.LinkedHashMap; | |||
| import java.util.Map; | |||
| import java.util.SortedMap; | |||
| import java.util.TreeMap; | |||
| @RestController | |||
| @RequestMapping("/WxPay/notify") | |||
| @RequestMapping("/wxPay/notify") | |||
| public class WxPayController extends BaseController { | |||
| private Logger logger = Logger.getLogger(WxPayController.class); | |||
| @@ -34,35 +36,47 @@ public class WxPayController extends BaseController { | |||
| * @return 接收微信异步通知 | |||
| * @throws Exception 可能产生的任何异常 | |||
| */ | |||
| @RequestMapping(value = "/pay", method = RequestMethod.POST) | |||
| @RequestMapping(value = "/pay") | |||
| public String _payNotify(HttpServletRequest request) throws Exception { | |||
| Map<String, String> paramMap = null; | |||
| String response; | |||
| try { | |||
| String xml = IOUtils.toString(request.getInputStream(), Charset.forName("UTF-8")); | |||
| paramMap = WxPayment.xmlToMap(xml); | |||
| logger.info("payment wxpay, notify, param: " + paramMap.toString() ); | |||
| response = wxPayOrderService.notify(paramMap, EnumPayWay.PAY_WAY_WEAPP); | |||
| String response = wxPayOrderService.notify(paramMap, EnumPayWay.PAY_WAY_WEAPP); | |||
| logger.info("payment wxpay, notify success, req : " + paramMap.toString() + ", resp: " + response.toString()); | |||
| return response; | |||
| } catch (BizMessageException e) { | |||
| logger.error("payment wxpay, notify error, req: " + paramMap.toString() + ", e:" + e.getLocalizedMessage()); | |||
| Map<String, String> resultMap = new LinkedHashMap<>(); | |||
| if (paramMap == null) { | |||
| logger.error("payment wxpay, order create error, e: " + e.getMessage()); | |||
| } else { | |||
| logger.error("payment wxpay, order create error, req: " + paramMap.toString() + ", e: " + e.getMessage()); | |||
| } | |||
| SortedMap resultMap = new TreeMap<>(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", e.getMessage()); | |||
| return XmlUtil.parseDto2Xml(resultMap, ""); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } catch (MallinkException e) { | |||
| logger.error("payment wxpay, notify error, req: " + paramMap.toString() + ", e:" +e.getLocalizedMessage()); | |||
| Map<String, String> resultMap = new LinkedHashMap<>(); | |||
| if (paramMap == null) { | |||
| logger.error("payment wxpay, order create error, e: " + e.getMessage()); | |||
| } else { | |||
| logger.error("payment wxpay, order create error, req: " + paramMap.toString() + ", e: " + e.getMessage()); | |||
| } | |||
| SortedMap resultMap = new TreeMap<>(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", e.getMessage()); | |||
| return XmlUtil.parseDto2Xml(resultMap, ""); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } catch (Exception e) { | |||
| logger.error("payment wxpay, order create error, req: " + paramMap.toString() + ", e: " + e.getMessage()); | |||
| Map<String, String> resultMap = new LinkedHashMap<>(); | |||
| if (paramMap == null) { | |||
| logger.error("payment wxpay, order create error, e: " + e.getMessage()); | |||
| } else { | |||
| logger.error("payment wxpay, order create error, req: " + paramMap.toString() + ", e: " + e.getMessage()); | |||
| } | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", e.getMessage()); | |||
| return XmlUtil.parseDto2Xml(resultMap, ""); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } | |||
| } | |||
| @@ -72,7 +86,7 @@ public class WxPayController extends BaseController { | |||
| * @return 接收微信退款异步通知 | |||
| * @throws Exception 可能产生的任何异常 | |||
| */ | |||
| @RequestMapping(value = "/refund", method = RequestMethod.POST) | |||
| @RequestMapping(value = "/refund") | |||
| public String __refundNotify(HttpServletRequest request) throws Exception { | |||
| Map<String, String> paramMap = null; | |||
| String response; | |||
| @@ -85,22 +99,22 @@ public class WxPayController extends BaseController { | |||
| return response; | |||
| } catch (BizMessageException e) { | |||
| logger.error("refund wxpay, notify error, req: " + paramMap.toString() + ", e:" + e.getLocalizedMessage()); | |||
| Map<String, String> resultMap = new LinkedHashMap<>(); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", e.getMessage()); | |||
| return XmlUtil.parseDto2Xml(resultMap, ""); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } catch (MallinkException e) { | |||
| logger.error("refund wxpay, notify error, req: " + paramMap.toString() + ", e:" +e.getLocalizedMessage()); | |||
| Map<String, String> resultMap = new LinkedHashMap<>(); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", e.getMessage()); | |||
| return XmlUtil.parseDto2Xml(resultMap, ""); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } catch (Exception e) { | |||
| logger.error("refund wxpay, order create error, req: " + paramMap.toString() + ", e: " + e.getMessage()); | |||
| Map<String, String> resultMap = new LinkedHashMap<>(); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", e.getMessage()); | |||
| return XmlUtil.parseDto2Xml(resultMap, ""); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } | |||
| } | |||
| @@ -1,7 +1,10 @@ | |||
| package com.simple.controller; | |||
| import java.util.ArrayList; | |||
| import java.util.Arrays; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -14,6 +17,7 @@ import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxTags; | |||
| import com.simple.domain.vo.WxTagsVo; | |||
| import com.simple.service.WxCUserTagsService; | |||
| import com.simple.service.WxTagsService; | |||
| import io.swagger.annotations.Api; | |||
| @@ -26,6 +30,9 @@ public class WxTagsController extends BaseController | |||
| { | |||
| @Autowired | |||
| private WxTagsService wxTagsService; | |||
| @Autowired | |||
| private WxCUserTagsService wxCUserTagsService; | |||
| private Logger logger = Logger.getLogger(WxTagsController.class); | |||
| @@ -48,6 +55,7 @@ public class WxTagsController extends BaseController | |||
| PageInfo<WxTags> page = wxTagsService.listAsPage(tag, 1, 1000); | |||
| for(WxTags wxT : page.getList()) { | |||
| WxTagsVo wxVo = new WxTagsVo(); | |||
| wxVo.setId(wxT.getId()); | |||
| wxVo.setValue(wxT.getName()); | |||
| list.add(wxVo); | |||
| } | |||
| @@ -57,10 +65,59 @@ public class WxTagsController extends BaseController | |||
| } | |||
| type1List.add(vo); | |||
| } | |||
| return new ResultData(Result.SUCCESS,"ok",type1List); | |||
| return new ResultData(Result.SUCCESS,"查询成功",type1List); | |||
| } | |||
| @GetMapping("getPeopleTagList") | |||
| @ApiOperation("用户人群tag接口") | |||
| public ResultData getPeopleTagList() { | |||
| List<WxTagsVo> type2List =new ArrayList<>(); | |||
| List<WxTags> type2s = wxTagsService.findType2Value(null); | |||
| for(WxTags wt:type2s) { | |||
| WxTagsVo v = new WxTagsVo(); | |||
| v.setValue(wt.getType2()); | |||
| List<WxTagsVo> list = new ArrayList<>(); | |||
| WxTags tag = new WxTags(); | |||
| tag.setType2(wt.getType2()); | |||
| PageInfo<WxTags> page = wxTagsService.listAsPage(tag, 1, 1000); | |||
| for(WxTags wxT : page.getList()) { | |||
| WxTagsVo wxVo = new WxTagsVo(); | |||
| wxVo.setValue(wxT.getName()); | |||
| wxVo.setId(wxT.getId()); | |||
| list.add(wxVo); | |||
| } | |||
| v.setSubTags(list); | |||
| type2List.add(v); | |||
| } | |||
| return new ResultData(Result.SUCCESS,"查询成功",type2List); | |||
| } | |||
| @ApiOperation("查询用户人群") | |||
| @GetMapping("findUserByTag") | |||
| public Result findUserByTag(Long[] tagIds) { | |||
| // WxTags wxTags = new WxTags(); | |||
| // List<Long> ids = new ArrayList<>(); | |||
| // for(Long id :tagIds) { | |||
| // ids.add(id); | |||
| // } | |||
| // wxTags.setIds(ids); | |||
| // PageInfo<WxTags> page = wxTagsService.listAsPage(wxTags, 1, 5000); | |||
| // List<WxTags> list = page.getList(); | |||
| // StringBuffer names= new StringBuffer(); | |||
| // for(WxTags t:list) { | |||
| // names.append(t.getName()+"/"); | |||
| // } | |||
| // Map<String,Object> map = new HashMap<>(); | |||
| // String endName=""; | |||
| // if(names.length()>0) { | |||
| // endName = names.toString().substring(0,names.length()-1); | |||
| // } | |||
| // map.put("names",endName ); | |||
| // map.put("tagIds", ids); | |||
| long count = wxCUserTagsService.findCountByTag(Arrays.asList(tagIds)); | |||
| return new ResultData(Result.SUCCESS,"查询成功",count); | |||
| } | |||
| // @ApiOperation("分页列表接口") | |||
| // @GetMapping("list") | |||
| @@ -39,8 +39,8 @@ public class Swagger2Config { | |||
| private ApiInfo apiInfo() { | |||
| return new ApiInfoBuilder() | |||
| .title("c端 api") | |||
| .description("c api") | |||
| .title("b端 api") | |||
| .description("b端 api") | |||
| .termsOfServiceUrl("http://localhost:9000") | |||
| .version("2.0") | |||
| .build(); | |||
| @@ -1,6 +1,7 @@ | |||
| package com.simple.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.annotation.AuthIgnore; | |||
| import com.simple.common.ErrorCode; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| @@ -102,10 +103,23 @@ public class WxCouponOrderController extends BaseController { | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxCouponOrderService.getById(id)); | |||
| @ApiOperation(value = "根据couponOrderId查询接口", notes = "{\"couponOrderId\":\"string\"}") | |||
| @PostMapping("/findById") | |||
| public ResultData findById(@RequestBody Map<String, String> paramMap) { | |||
| logger.info(paramMap.toString()); | |||
| String couponOrderIdStr = paramMap.get("couponOrderId"); | |||
| if (StringUtils.isBlank(couponOrderIdStr)) { | |||
| logger.error("couponOrderId不能为空: " + paramMap.toString()); | |||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "couponOrderId不能为空"); | |||
| } | |||
| Long couponOrderId = 0L; | |||
| try { | |||
| couponOrderId = Long.valueOf(couponOrderIdStr); | |||
| } catch (NumberFormatException e) { | |||
| couponOrderId = 0L; | |||
| logger.error("couponOrderId参数不正确: " + paramMap.toString()); | |||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "couponOrderId参数不正确"); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxCouponOrderService.getById(couponOrderId)); | |||
| } | |||
| } | |||
| @@ -6,6 +6,7 @@ import java.util.List; | |||
| import org.apache.log4j.Logger; | |||
| 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.RestController; | |||
| @@ -13,6 +14,7 @@ import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxDateAmountRecord; | |||
| import com.simple.domain.po.WxMerchantBUser; | |||
| import com.simple.domain.vo.AmountRecordVo; | |||
| import com.simple.service.WxDateAmountRecordService; | |||
| @@ -22,7 +24,7 @@ import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| @RestController | |||
| @RequestMapping("wxDateAmountRecord") | |||
| @RequestMapping("/api/wxDateAmountRecord") | |||
| @Api(description="首页查询交易金额记录和核销记录接口") | |||
| public class WxDateAmountRecordController extends BaseController | |||
| { | |||
| @@ -33,16 +35,15 @@ public class WxDateAmountRecordController extends BaseController | |||
| @ApiOperation("首页查询交易金额记录和核销记录接口") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="tenantId",value="租户id",dataType="String", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="merchantId",value="商户id",dataType="long", paramType = "query",required=true)}) | |||
| public ResultData getRecord(String tenantId,Long merchantId) { | |||
| @GetMapping("list") | |||
| public ResultData getRecord() { | |||
| Calendar c =Calendar.getInstance(); | |||
| int weekOfYear =c.get(Calendar.WEEK_OF_YEAR); | |||
| WxDateAmountRecord temp = new WxDateAmountRecord(); | |||
| temp.setDayOfWeek(weekOfYear); | |||
| temp.setTenantId(tenantId); | |||
| temp.setMerchantId(merchantId); | |||
| WxMerchantBUser u = getUser(); | |||
| temp.setTenantId(u.getTenantId()); | |||
| temp.setMerchantId(u.getMerchantId()); | |||
| AmountRecordVo vo = new AmountRecordVo(); | |||
| vo.setOrderAmountList(getAmountRecord(temp, 0)); | |||
| vo.setVerifyAmountList(getAmountRecord(temp, 0)); | |||
| @@ -4,6 +4,10 @@ import cn.binarywang.wx.miniapp.api.WxMaService; | |||
| import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; | |||
| import com.simple.annotation.AuthIgnore; | |||
| import com.simple.common.ErrorCode; | |||
| import com.simple.domain.po.WxMall; | |||
| import com.simple.domain.po.WxMerchant; | |||
| import com.simple.service.WxMallService; | |||
| import com.simple.service.WxMerchantService; | |||
| import com.simple.utils.IPUtil; | |||
| import me.chanjar.weixin.common.error.WxErrorException; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| @@ -30,7 +34,7 @@ import java.util.HashMap; | |||
| import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("wxMerchantBUser") | |||
| @RequestMapping("/api/user") | |||
| public class WxMerchantBUserController extends BaseController | |||
| { | |||
| private Logger logger = Logger.getLogger(WxMerchantBUserController.class); | |||
| @@ -38,6 +42,41 @@ public class WxMerchantBUserController extends BaseController | |||
| @Autowired | |||
| private WxMerchantBUserService wxMerchantBUserService; | |||
| @Autowired | |||
| private WxMerchantService wxMerchantService; | |||
| @Autowired | |||
| private WxMallService wxMallService; | |||
| @ApiOperation("查寻当bUser详情接口") | |||
| @GetMapping("/detail") | |||
| public ResultData detail() { | |||
| Map resultMap = new HashMap(); | |||
| WxMerchantBUser user = wxMerchantBUserService.getById(getUser().getId()); | |||
| if (user==null) | |||
| return new ResultData(ErrorCode.USER_IS_EMPTY, ErrorCode.USER_IS_EMPTY.getMessage()); | |||
| WxMerchant merchant = wxMerchantService.getById(user.getMerchantId()); | |||
| if (merchant==null) | |||
| return new ResultData(ErrorCode.MCH_INFO_NOT_FOUND, ErrorCode.MCH_INFO_NOT_FOUND.getMessage()); | |||
| WxMall mall = wxMallService.getByTenantId(merchant.getTenantId()); | |||
| if (mall==null) | |||
| return new ResultData(ErrorCode.MCH_INFO_NOT_FOUND, ErrorCode.MCH_INFO_NOT_FOUND.getMessage()); | |||
| resultMap.put("phone",user.getPhone()); | |||
| resultMap.put("name",user.getName()); | |||
| resultMap.put("merchant_name",merchant.getName()); | |||
| resultMap.put("mall_name",mall.getName()); | |||
| resultMap.put("service_phone",mall.getServicePhone()); | |||
| return new ResultData(Result.SUCCESS,"查询成功",resultMap); | |||
| } | |||
| /** | |||
| * 用户登录 | |||
| * @param map | |||
| @@ -73,16 +112,20 @@ public class WxMerchantBUserController extends BaseController | |||
| WxMerchantBUser user = new WxMerchantBUser(); | |||
| user.setAppId(appId); | |||
| user.setPhone(phone); | |||
| user.setBUserPwd(password); | |||
| try { | |||
| WxMerchantBUser user1 = wxMerchantBUserService.getById(user.getId()); | |||
| WxMerchantBUser user1 = wxMerchantBUserService.getBUserByAppId(user); | |||
| if (user1 != null) { | |||
| user1.createToken(new Date()); | |||
| token = user1.getToken(); | |||
| wxMerchantBUserService.saveOrUpdate(user1); | |||
| resultMap.put("token", token); | |||
| if (user1.getBUserPwd().equalsIgnoreCase(password)) { | |||
| user1.createToken(new Date()); | |||
| token = user1.getToken(); | |||
| wxMerchantBUserService.saveOrUpdate(user1); | |||
| resultMap.put("token", token); | |||
| } else { | |||
| return new ResultData(ErrorCode.PASSWORD_ERROR); | |||
| } | |||
| } else { | |||
| user.setBUserPwd(password); | |||
| user.createToken(new Date()); | |||
| token = user.getToken(); | |||
| @@ -95,5 +138,16 @@ public class WxMerchantBUserController extends BaseController | |||
| } | |||
| return new ResultData(resultMap); | |||
| } | |||
| @AuthIgnore | |||
| @ApiOperation("修改密码") | |||
| @PostMapping("/updatepwd") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="phone",value="手机号",dataType="String", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="code",value="验证码",dataType="String", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pwd",value="密码",dataType="String", paramType = "query",required=true)}) | |||
| public ResultData updatepwd(String phone,String code,String pwd) { | |||
| return wxMerchantBUserService.updatepwd(phone,code,pwd); | |||
| } | |||
| } | |||
| @@ -0,0 +1,55 @@ | |||
| package com.simple.controller; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxMsgValidationcode; | |||
| import com.simple.service.WxMsgValidationcodeService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import org.apache.log4j.Logger; | |||
| 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.RestController; | |||
| @RestController | |||
| @RequestMapping("wxMsgValidationcode") | |||
| public class WxMsgValidationcodeController extends BaseController { | |||
| private Logger logger = Logger.getLogger(WxMsgValidationcodeController.class); | |||
| @Autowired | |||
| private WxMsgValidationcodeService wxMsgValidationcodeService; | |||
| @GetMapping("sendvalidationcode") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "tenantId", value = "租户ID", dataType = "String", paramType = "query"), | |||
| @ApiImplicitParam(name = "phone", value = "手机号", dataType = "String", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "type", value = "场景", dataType = "Integer", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "appid", value = "appid", dataType = "String", paramType = "query", required = true)}) | |||
| public ResultData sendvalidationcode(String tenantId, String phone, Integer type, String appid) { | |||
| WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); | |||
| wxMsgValidationcode.setTenantId(tenantId); | |||
| wxMsgValidationcode.setPhone(phone); | |||
| wxMsgValidationcode.setType(type); | |||
| wxMsgValidationcode.setAppid(appid); | |||
| return wxMsgValidationcodeService.sendvalidationcode(wxMsgValidationcode); | |||
| } | |||
| @GetMapping("hasvalidationcode") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "tenantId", value = "租户ID", dataType = "String", paramType = "query"), | |||
| @ApiImplicitParam(name = "phone", value = "手机号", dataType = "String", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "type", value = "场景", dataType = "Integer", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "code", value = "验证码", dataType = "String", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "appid", value = "appid", dataType = "String", paramType = "query", required = true)}) | |||
| public ResultData hasvalidationcode(String tenantId, String phone, Integer type, String code, String appid) { | |||
| WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); | |||
| wxMsgValidationcode.setTenantId(tenantId); | |||
| wxMsgValidationcode.setPhone(phone); | |||
| wxMsgValidationcode.setType(type); | |||
| wxMsgValidationcode.setCode(code); | |||
| wxMsgValidationcode.setAppid(appid); | |||
| return wxMsgValidationcodeService.hasvalidationcode(wxMsgValidationcode); | |||
| } | |||
| } | |||
| @@ -60,6 +60,12 @@ public class BaseController { | |||
| return user; | |||
| } | |||
| public Long getUserId() { | |||
| HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| Long cUserId = (Long)request.getAttribute(AuthorizationInterceptor.LOGIN_USER_KEY); | |||
| return cUserId; | |||
| } | |||
| public String getTenantId(){ | |||
| HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| Long cUserId = (Long)request.getAttribute(AuthorizationInterceptor.LOGIN_USER_KEY); | |||
| @@ -28,6 +28,34 @@ public class WxCouponOrderController extends BaseController { | |||
| @Autowired | |||
| private WxCouponOrderService wxCouponOrderService; | |||
| @ApiOperation(value = "退券接口", notes = "{\"couponOrderId\":\"string\"}") | |||
| @PostMapping("refund") | |||
| public ResultData refund(@RequestBody Map<String, String> paramMap) { | |||
| logger.info(paramMap.toString()); | |||
| String couponOrderIdStr = paramMap.get("couponOrderId"); | |||
| if (StringUtils.isBlank(couponOrderIdStr)) { | |||
| logger.error("couponOrderId不能为空: " + paramMap.toString()); | |||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "couponOrderId不能为空"); | |||
| } | |||
| Long couponOrderId = 0L; | |||
| try { | |||
| couponOrderId = Long.valueOf(couponOrderIdStr); | |||
| } catch (NumberFormatException e) { | |||
| logger.error("couponOrderId参数不正确: " + paramMap.toString()); | |||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "couponOrderId参数不正确"); | |||
| } | |||
| try { | |||
| ResultData rd = wxCouponOrderService.refund(couponOrderId, getUser().getId()); | |||
| return rd; | |||
| } catch (MallinkException e) { | |||
| logger.error("退券异常: " + e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } catch (Exception e) { | |||
| logger.error("退券异常: " + e.getMessage()); | |||
| return new ResultData(ErrorCode.REFUND_ORDER_ERROR, e.getMessage()); | |||
| } | |||
| } | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @@ -46,7 +74,7 @@ public class WxCouponOrderController extends BaseController { | |||
| } | |||
| @ApiOperation(value = "根据id查询接口", notes = "{\"couponOrderId\":\"string\"}") | |||
| @GetMapping("/findById") | |||
| @PostMapping("/findById") | |||
| public ResultData findById(@RequestBody Map<String, String> paramMap) { | |||
| logger.info(paramMap.toString()); | |||
| String couponOrderIdStr = paramMap.get("couponOrderId"); | |||
| @@ -31,6 +31,37 @@ public class WxOrderController extends BaseController { | |||
| @Autowired | |||
| private WxOrderService wxOrderService; | |||
| @ApiOperation(value = "免费领取", notes = "{\"couponId\":\"String\"}") | |||
| @PostMapping("freeCoupon") | |||
| public ResultData freeCoupon(@RequestBody Map<String, String> paramMap) { | |||
| //Assert.notNull(wxOrders.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| String couponIdStr = paramMap.get("couponId"); | |||
| if (StringUtils.isBlank(couponIdStr)) { | |||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "couponId不能为空"); | |||
| } | |||
| Long couponId = 0L; | |||
| try { | |||
| couponId = Long.valueOf(couponIdStr); | |||
| } catch (NumberFormatException e) { | |||
| logger.error("couponId convert error, " + couponIdStr + ", e:" + e.getMessage()); | |||
| return new ResultData(ErrorCode.PARAMETER_CAST_ERROR.getCode(), "couponId: " + couponIdStr + ", e:" + e.getMessage()); | |||
| } | |||
| Long cUserId = getUserId(); | |||
| try { | |||
| WxOrder order = wxOrderService.sendUserFreeCoupon(cUserId, couponId); | |||
| return new ResultData(order); | |||
| } catch (MallinkException e) { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(ErrorCode.ORDER_IS_FAIL, e.getMessage()); | |||
| } | |||
| } | |||
| @ApiOperation(value = "下订单", notes = "{\"couponId\":\"String\"}") | |||
| @PostMapping("save") | |||
| public ResultData saveOrder(@RequestBody Map<String, String> paramMap) { | |||
| @@ -40,15 +71,24 @@ public class WxOrderController extends BaseController { | |||
| if (StringUtils.isBlank(couponIdStr)) { | |||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "couponId不能为空"); | |||
| } | |||
| Long couponId = Long.valueOf(couponIdStr); | |||
| Long couponId = 0L; | |||
| try { | |||
| couponId = Long.valueOf(couponIdStr); | |||
| } catch (NumberFormatException e) { | |||
| logger.error("couponId convert error, " + couponIdStr + ", e:" + e.getMessage()); | |||
| return new ResultData(ErrorCode.PARAMETER_CAST_ERROR.getCode(), "couponId: " + couponIdStr + ", e:" + e.getMessage()); | |||
| } | |||
| WxCUser user = getUser(); | |||
| try { | |||
| WxOrder order = wxOrderService.saveOrder(user, couponId); | |||
| return new ResultData(order); | |||
| }catch (MallinkException e) { | |||
| } catch (MallinkException e) { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(ErrorCode.ORDER_IS_FAIL, e.getMessage()); | |||
| } | |||
| } | |||
| @@ -67,6 +107,7 @@ public class WxOrderController extends BaseController { | |||
| orderId = Long.valueOf(orderIdStr); | |||
| } catch (NumberFormatException e) { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL, "orderId: " + orderIdStr + ", e: " + e.getMessage()); | |||
| } | |||
| wxOrderService.updateOrderStatus(orderId, EnumOrderStatus.ORDER_STATUS_OVERTIME_CANCEL); | |||
| return new ResultData(); | |||
| @@ -59,7 +59,6 @@ public class WxPayOrderController extends BaseController { | |||
| try { | |||
| orderId = Long.valueOf(orderIdStr); | |||
| } catch (NumberFormatException e) { | |||
| orderId = 0L; | |||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "orderId参数不正确"); | |||
| } | |||
| WxPayOrder record = new WxPayOrder(); | |||
| @@ -73,11 +72,11 @@ public class WxPayOrderController extends BaseController { | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } catch (Exception e) { | |||
| logger.error("payment wechat, order create error, req 3: " + record.toString() + ", e:" + e.getMessage()); | |||
| return new ResultData(ErrorCode.PAY_ORDER_ERROR, e.getMessage()); | |||
| } | |||
| return new ResultData(ErrorCode.PAY_ORDER_ERROR); | |||
| } | |||
| @ApiOperation(value = "更新支付订单状态", notes = "{\"id\":\"string\",\"orderId\":\"string\",\"status\":integer,\"reason\":\"string\"}") | |||
| @ApiOperation(value = "更新支付订单状态", notes = "{\"payOrderId\":\"string\",\"orderId\":\"string\",\"status\":integer,\"reason\":\"string\"}") | |||
| @PostMapping("/updatePayOrder") | |||
| public ResultData updatePayOrder(@RequestBody Map<String, Object> paramMap) { | |||
| logger.info("/api/pay/updatePayOrder" + paramMap.toString()); | |||
| @@ -85,22 +84,11 @@ public class WxPayOrderController extends BaseController { | |||
| String orderIdStr = (String)paramMap.get("orderId"); | |||
| String reasonStr = (String)paramMap.get("reason"); | |||
| Integer status = (Integer)paramMap.get("status"); | |||
| if (StringUtils.isBlank(payOrderIdStr)) { | |||
| logger.info("payOrderId不能为空: " + paramMap.toString()); | |||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "payOrderId不能为空"); | |||
| } | |||
| if (StringUtils.isBlank(orderIdStr)) { | |||
| logger.info("orderId不能为空: " + paramMap.toString()); | |||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "orderId不能为空"); | |||
| } | |||
| Long payOrderId = 0L, orderId = 0L; | |||
| try { | |||
| payOrderId = Long.valueOf(payOrderIdStr); | |||
| } catch (NumberFormatException e) { | |||
| payOrderId = 0L; | |||
| logger.error("payOrderId参数不正确: " + paramMap.toString() + ", e:" + e.getMessage()); | |||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "payOrderId参数不正确"); | |||
| } | |||
| try { | |||
| orderId = Long.valueOf(orderIdStr); | |||
| } catch (NumberFormatException e) { | |||
| @@ -108,6 +96,14 @@ public class WxPayOrderController extends BaseController { | |||
| logger.error("orderId参数不正确: " + paramMap.toString() + ", e:" + e.getMessage()); | |||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "orderId参数不正确"); | |||
| } | |||
| if (!StringUtils.isBlank(payOrderIdStr)) { | |||
| try { | |||
| payOrderId = Long.valueOf(payOrderIdStr); | |||
| } catch (NumberFormatException e) { | |||
| logger.error("payOrderId参数不正确: " + paramMap.toString() + ", e:" + e.getMessage()); | |||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "payOrderId参数不正确"); | |||
| } | |||
| } | |||
| WxPayOrder payOrder = new WxPayOrder(); | |||
| payOrder.setId(payOrderId); | |||
| @@ -0,0 +1,94 @@ | |||
| package com.simple.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.ErrorCode; | |||
| 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.WxMerchantBUser; | |||
| import com.simple.domain.po.WxRefundOrder; | |||
| import com.simple.enums.EnumPayWay; | |||
| import com.simple.exception.MallinkException; | |||
| import com.simple.service.WxRefundOrderService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("/api/refund") | |||
| public class WxRefundOrderController extends BaseController | |||
| { | |||
| private Logger logger = Logger.getLogger(WxRefundOrderController.class); | |||
| @Autowired | |||
| private WxRefundOrderService wxRefundOrderService; | |||
| @ApiOperation(value = "发起退款", notes = "{\"orderId\":,\"string\", \"payOrderId\":\"string\"}") | |||
| @PostMapping("/create") | |||
| public ResultData create(@RequestBody Map<String, String> paramMap) { | |||
| logger.info("/api/refund/create" + paramMap.toString()); | |||
| //Assert.notNull(wxRefundOrder.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| String orderIdStr = paramMap.get("orderId"); | |||
| String payOrderIdStr = paramMap.get("payOrderId"); | |||
| if (StringUtils.isBlank(orderIdStr)) { | |||
| logger.error("orderId不能为空: " + paramMap.toString()); | |||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "orderId不能为空"); | |||
| } | |||
| if (StringUtils.isBlank(payOrderIdStr)) { | |||
| logger.error("payOrderId不能为空: " + paramMap.toString()); | |||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "payOrderId不能为空"); | |||
| } | |||
| Long orderId = 0L; | |||
| try { | |||
| orderId = Long.valueOf(orderIdStr); | |||
| } catch (NumberFormatException e) { | |||
| logger.error("orderId参数不正确: " + paramMap.toString()); | |||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "orderId参数不正确"); | |||
| } | |||
| WxRefundOrder refundOrder = new WxRefundOrder(); | |||
| refundOrder.setPayOrderNo(payOrderIdStr); | |||
| refundOrder.setOrderId(orderId); | |||
| WxCUser cUser = getUser(); | |||
| WxAppinfo appinfo = getAppInfo(cUser.getAppId()); | |||
| try { | |||
| wxRefundOrderService.createRefundOrder(appinfo, refundOrder, EnumPayWay.PAY_WAY_WEAPP); | |||
| return new ResultData(); | |||
| } catch (MallinkException e) { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(ErrorCode.REFUND_ORDER_ERROR); | |||
| } | |||
| } | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxRefundOrder wxRefundOrder,Integer pageNum, Integer pageSize) { | |||
| if (null == wxRefundOrder) wxRefundOrder = new WxRefundOrder(); | |||
| final PageInfo<WxRefundOrder> page = wxRefundOrderService.listAsPage(wxRefundOrder, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxRefundOrderService.getById(id)); | |||
| } | |||
| } | |||
| @@ -50,6 +50,7 @@ public enum ErrorCode{ | |||
| COUPON_IS_EMPTY(2020, "券不存在"), | |||
| COUPON_IS_NOT_FREE(2021, "券不存在"), | |||
| /** | |||
| * 车流 2040 | |||
| @@ -76,7 +77,7 @@ public enum ErrorCode{ | |||
| */ | |||
| REMAIN_IS_EMPTY(3000, "库存不足"), | |||
| ORDER_IS_LIMITED(3001, "购买超限"), | |||
| ORDER_IS_FAIL(3002, "订单创建失败"), | |||
| ORDER_IS_FAIL(3002, "订单失败"), | |||
| ORDER_IS_NOT_FIND(3003, "订单不存在"), | |||
| ORDER_IS_NOT_PAY(3004, "订单已不能进行支付"), | |||
| @@ -103,6 +104,8 @@ public enum ErrorCode{ | |||
| PAY_ORDER_EXIST(12001, "支付订单已存在"), | |||
| PAY_ORDER_ERROR(12002, "支付订单异常"), | |||
| PAY_ORDER_NOTIFY_CHECK_SIGN_ERROR(12003 , "支付验签失败"), | |||
| PAY_ORDER_IS_ZERO(12004, "支付订单金额为0"), | |||
| PAY_ORDER_IS_NOT_PAYMENT(12005, "不是支付订单"), | |||
| REFUND_ORDER_EXIST(12010, "退款订单已存在"), | |||
| REFUND_PAY_ORDER_IS_NOT_EXIST(12011, "退款支付订单不存在"), | |||
| @@ -117,15 +120,19 @@ public enum ErrorCode{ | |||
| CERT_PATH_NOT_FOUND(12024, "双向证书未配置"), | |||
| PROFIT_SHARING_REQUEST_FAILED(12030, "分账请求失败"), | |||
| PROFIT_SHARING_APPLY_FAILED(12031, "分账请求业务失败"), | |||
| PROFIT_SHARING_APPLY_FAILED(12031, "分账业务失败"), | |||
| PROFIT_SHARING_RETURN_INVALID(12032, "分账请求返回校验失败"), | |||
| PROFIT_SHARING_RECEIVER_INVALID(12033, "分账接受方查寻无效"), | |||
| PROFIT_SHARING_QUERY_REQUEST_FAILED(12030, "分账查询请求失败"), | |||
| PROFIT_SHARING_QUERY_APPLY_FAILED(12031, "分账查询业务失败"), | |||
| PROFIT_SHARING_QUERY_RETURN_INVALID(12032, "分账查询返回校验失败"), | |||
| /** | |||
| * 核销 | |||
| */ | |||
| VERIFY_ERROR(12050, "核销异常") | |||
| ; | |||
| VERIFY_ERROR(12050, "核销异常"), | |||
| MSG_REPEAT_SEND(12061, "短信重新发送") | |||
| ; | |||
| @@ -0,0 +1,273 @@ | |||
| package com.simple.domain.po; | |||
| import com.simple.domain.vo.WxChooseTagVo; | |||
| import javax.persistence.*; | |||
| import java.util.*; | |||
| import javax.persistence.Transient; | |||
| import java.util.List; | |||
| import javax.persistence.Id; | |||
| import java.io.Serializable; | |||
| @Table(name = "coupon_inject") | |||
| public class CouponInject implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @Id | |||
| protected Long id; | |||
| @Transient | |||
| protected List<Long> ids; | |||
| @Transient | |||
| protected String sortColumns; | |||
| @Transient | |||
| protected WxChooseTagVo wxChooseTagVo; | |||
| @Transient | |||
| protected Date sendTimeStart; | |||
| @Transient | |||
| protected Date sendTimeEnd; | |||
| public Long getId() { | |||
| return id; | |||
| } | |||
| public void setId(Long id) { | |||
| this.id = id; | |||
| } | |||
| public String getSortColumns() { | |||
| return sortColumns; | |||
| } | |||
| public List<Long> getIds() { | |||
| return ids; | |||
| } | |||
| public void setIds(List<Long> ids) { | |||
| this.ids = ids; | |||
| } | |||
| /***/ | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="tenantId") | |||
| private String tenantId; | |||
| /*任务名称**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="任务名称",name="name") | |||
| private String name; | |||
| /***/ | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="mUserId") | |||
| private Long mUserId; | |||
| /*发送方式0:立即发送 1:定时发送**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="发送方式0:立即发送 1:定时发送",name="sendType") | |||
| private Integer sendType; | |||
| /*券id**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="券id",name="couponId") | |||
| private Long couponId; | |||
| /*券名称**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="券名称",name="couponName") | |||
| private String couponName; | |||
| /*发送时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="发送时间",name="sendTime") | |||
| private Date sendTime; | |||
| /*实际发送数量**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="实际发送数量",name="sendAmount") | |||
| private Integer sendAmount; | |||
| /*0:待发送1:发送中2:已发送3:发送失败4已作废**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="0:待发送1:发送中2:已发送3:发送失败4已作废",name="status") | |||
| private Integer status; | |||
| /*发送失败原因**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="发送失败原因",name="errorMsg") | |||
| private String errorMsg; | |||
| /*发送人群标签**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="发送人群标签",name="tags") | |||
| private String tags; | |||
| /*短信模板id**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="短信模板id",name="modelId") | |||
| private Long modelId; | |||
| /*创建时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime") | |||
| private Date createTime; | |||
| /*修改时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="修改时间",name="updateTime") | |||
| private Date updateTime; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String _tenantId) { | |||
| tenantId = _tenantId; | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| public void setName(String _name) { | |||
| name = _name; | |||
| } | |||
| public Long getMUserId() { | |||
| return mUserId; | |||
| } | |||
| public void setMUserId(Long _mUserId) { | |||
| mUserId = _mUserId; | |||
| } | |||
| public Integer getSendType() { | |||
| return sendType; | |||
| } | |||
| public void setSendType(Integer _sendType) { | |||
| sendType = _sendType; | |||
| } | |||
| public Long getCouponId() { | |||
| return couponId; | |||
| } | |||
| public void setCouponId(Long _couponId) { | |||
| couponId = _couponId; | |||
| } | |||
| public String getCouponName() { | |||
| return couponName; | |||
| } | |||
| public void setCouponName(String _couponName) { | |||
| couponName = _couponName; | |||
| } | |||
| public Date getSendTime() { | |||
| return sendTime; | |||
| } | |||
| public void setSendTime(Date _sendTime) { | |||
| sendTime = _sendTime; | |||
| } | |||
| public Integer getSendAmount() { | |||
| return sendAmount; | |||
| } | |||
| public void setSendAmount(Integer _sendAmount) { | |||
| sendAmount = _sendAmount; | |||
| } | |||
| public Integer getStatus() { | |||
| return status; | |||
| } | |||
| public void setStatus(Integer _status) { | |||
| status = _status; | |||
| } | |||
| public String getErrorMsg() { | |||
| return errorMsg; | |||
| } | |||
| public void setErrorMsg(String _errorMsg) { | |||
| errorMsg = _errorMsg; | |||
| } | |||
| public String getTags() { | |||
| return tags; | |||
| } | |||
| public void setTags(String _tags) { | |||
| tags = _tags; | |||
| } | |||
| public Long getModelId() { | |||
| return modelId; | |||
| } | |||
| public void setModelId(Long _modelId) { | |||
| modelId = _modelId; | |||
| } | |||
| public Date getCreateTime() { | |||
| return createTime; | |||
| } | |||
| public void setCreateTime(Date _createTime) { | |||
| createTime = _createTime; | |||
| } | |||
| public Date getUpdateTime() { | |||
| return updateTime; | |||
| } | |||
| public void setUpdateTime(Date _updateTime) { | |||
| updateTime = _updateTime; | |||
| } | |||
| public WxChooseTagVo getWxChooseTagVo() { | |||
| return wxChooseTagVo; | |||
| } | |||
| public void setWxChooseTagVo(WxChooseTagVo wxChooseTagVo) { | |||
| this.wxChooseTagVo = wxChooseTagVo; | |||
| } | |||
| public Date getSendTimeStart() { | |||
| return sendTimeStart; | |||
| } | |||
| public void setSendTimeStart(Date sendTimeStart) { | |||
| this.sendTimeStart = sendTimeStart; | |||
| } | |||
| public Date getSendTimeEnd() { | |||
| return sendTimeEnd; | |||
| } | |||
| public void setSendTimeEnd(Date sendTimeEnd) { | |||
| this.sendTimeEnd = sendTimeEnd; | |||
| } | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||
| ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") | |||
| ,MUserId_ASC("`mUserId` ASC"),MUserId_DESC("`mUserId` DESC") | |||
| ,SendType_ASC("`sendType` ASC"),SendType_DESC("`sendType` DESC") | |||
| ,CouponId_ASC("`couponId` ASC"),CouponId_DESC("`couponId` DESC") | |||
| ,CouponName_ASC("`couponName` ASC"),CouponName_DESC("`couponName` DESC") | |||
| ,SendTime_ASC("`sendTime` ASC"),SendTime_DESC("`sendTime` DESC") | |||
| ,SendAmount_ASC("`sendAmount` ASC"),SendAmount_DESC("`sendAmount` DESC") | |||
| ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") | |||
| ,ErrorMsg_ASC("`errorMsg` ASC"),ErrorMsg_DESC("`errorMsg` DESC") | |||
| ,Tags_ASC("`tags` ASC"),Tags_DESC("`tags` DESC") | |||
| ,ModelId_ASC("`modelId` ASC"),ModelId_DESC("`modelId` DESC") | |||
| ,CreateTime_ASC("`createTime` ASC"),CreateTime_DESC("`createTime` DESC") | |||
| ,UpdateTime_ASC("`updateTime` ASC"),UpdateTime_DESC("`updateTime` DESC") | |||
| ; | |||
| private String value; | |||
| Field(String value){ | |||
| this.value = value; | |||
| } | |||
| public String getValue() { | |||
| return value; | |||
| } | |||
| public void setCol(String value) { | |||
| this.value = value; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return this.getValue(); | |||
| } | |||
| } | |||
| public void setSortColumns(CouponInject.Field... fields) | |||
| { | |||
| if (fields == null || fields.length == 0) { | |||
| return; | |||
| } | |||
| for (int k = 0; k < fields.length; k++) { | |||
| if (fields[k] == null) { | |||
| return; | |||
| } | |||
| } | |||
| StringBuilder sb = new StringBuilder(fields[0].toString()); | |||
| for (int k = 1; k < fields.length; k++) { | |||
| sb.append(","); | |||
| sb.append(fields[k].toString()); | |||
| } | |||
| } | |||
| public void setSortColumns(String sortColumns) | |||
| { | |||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||
| return; | |||
| } | |||
| if (sortColumns.contains(",")) { | |||
| String[] cols = sortColumns.split(","); | |||
| java.util.List<Field> fList = new java.util.ArrayList(); | |||
| for (int k = 0; k < cols.length; k++) { | |||
| fList.add(Field.valueOf(cols[k])); | |||
| } | |||
| this.setSortColumns(fList.toArray(new Field[fList.size()])); | |||
| } else { | |||
| this.setSortColumns(Field.valueOf(sortColumns)); | |||
| } | |||
| } | |||
| } | |||
| @@ -86,7 +86,17 @@ public class WxCUserBasicInfo implements Serializable { | |||
| @Transient | |||
| private String tags ; | |||
| @Transient | |||
| private List<WxTags> tagList; | |||
| public List<WxTags> getTagList() { | |||
| return tagList; | |||
| } | |||
| public void setTagList(List<WxTags> tagList) { | |||
| this.tagList = tagList; | |||
| } | |||
| public Long getcUserId() { | |||
| return cUserId; | |||
| } | |||
| @@ -0,0 +1,282 @@ | |||
| package com.simple.domain.po; | |||
| import javax.persistence.*; | |||
| import java.util.*; | |||
| import java.math.*; | |||
| import javax.persistence.Transient; | |||
| import java.util.List; | |||
| import javax.persistence.Id; | |||
| import java.io.Serializable; | |||
| @Table(name = "wx_campaign") | |||
| public class WxCampaign implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @Id | |||
| protected Long id; | |||
| @Transient | |||
| protected List<Long> ids; | |||
| @Transient | |||
| protected String sortColumns; | |||
| @Transient | |||
| protected List<WxCoupon> coupons; | |||
| public List<WxCoupon> getCoupons() { | |||
| return coupons; | |||
| } | |||
| public void setCoupons(List<WxCoupon> coupons) { | |||
| this.coupons = coupons; | |||
| } | |||
| public Long getId() { | |||
| return id; | |||
| } | |||
| public void setId(Long id) { | |||
| this.id = id; | |||
| } | |||
| public String getSortColumns() { | |||
| return sortColumns; | |||
| } | |||
| public List<Long> getIds() { | |||
| return ids; | |||
| } | |||
| public void setIds(List<Long> ids) { | |||
| this.ids = ids; | |||
| } | |||
| /***/ | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="tenantId") | |||
| private String tenantId; | |||
| /*封面图**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="封面图",name="coverImg") | |||
| private String coverImg; | |||
| /*主标题**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="主标题",name="title") | |||
| private String title; | |||
| /*副标题**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="副标题",name="subTitle") | |||
| private String subTitle; | |||
| /*满x可用**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="满x可用",name="usePrice") | |||
| private Integer usePrice; | |||
| /*折扣**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="折扣",name="discountPrice") | |||
| private Integer discountPrice; | |||
| /*活动说明**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="活动说明",name="detail") | |||
| private String detail; | |||
| /*有效日期-开始**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="有效日期-开始",name="validStartDate") | |||
| private Date validStartDate; | |||
| /*有效日期-结束**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="有效日期-结束",name="validEndDate") | |||
| private Date validEndDate; | |||
| /*图文详情**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="图文详情",name="imgDetail") | |||
| private String imgDetail; | |||
| /*类型:0:促销 1:宣传页**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="类型:0:促销 1:宣传页",name="type") | |||
| private Integer type; | |||
| /*优惠券ids**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="优惠券ids",name="couponIds") | |||
| private String couponIds; | |||
| /*门店id**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="门店id",name="mechantId") | |||
| private Long mechantId; | |||
| /*排序**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="排序",name="sortNum") | |||
| private Integer sortNum; | |||
| /*0上线 1下线**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="0上线 1下线",name="status") | |||
| private Integer status; | |||
| /***/ | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="createTime") | |||
| private Date createTime; | |||
| /***/ | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="updateTime") | |||
| private Date updateTime; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String _tenantId) { | |||
| tenantId = _tenantId; | |||
| } | |||
| public String getCoverImg() { | |||
| return coverImg; | |||
| } | |||
| public void setCoverImg(String _coverImg) { | |||
| coverImg = _coverImg; | |||
| } | |||
| public String getTitle() { | |||
| return title; | |||
| } | |||
| public void setTitle(String _title) { | |||
| title = _title; | |||
| } | |||
| public String getSubTitle() { | |||
| return subTitle; | |||
| } | |||
| public void setSubTitle(String _subTitle) { | |||
| subTitle = _subTitle; | |||
| } | |||
| public Integer getUsePrice() { | |||
| return usePrice; | |||
| } | |||
| public void setUsePrice(Integer _usePrice) { | |||
| usePrice = _usePrice; | |||
| } | |||
| public Integer getDiscountPrice() { | |||
| return discountPrice; | |||
| } | |||
| public void setDiscountPrice(Integer _discountPrice) { | |||
| discountPrice = _discountPrice; | |||
| } | |||
| public String getDetail() { | |||
| return detail; | |||
| } | |||
| public void setDetail(String _detail) { | |||
| detail = _detail; | |||
| } | |||
| public Date getValidStartDate() { | |||
| return validStartDate; | |||
| } | |||
| public void setValidStartDate(Date _validStartDate) { | |||
| validStartDate = _validStartDate; | |||
| } | |||
| public Date getValidEndDate() { | |||
| return validEndDate; | |||
| } | |||
| public void setValidEndDate(Date _validEndDate) { | |||
| validEndDate = _validEndDate; | |||
| } | |||
| public String getImgDetail() { | |||
| return imgDetail; | |||
| } | |||
| public void setImgDetail(String _imgDetail) { | |||
| imgDetail = _imgDetail; | |||
| } | |||
| public Integer getType() { | |||
| return type; | |||
| } | |||
| public void setType(Integer _type) { | |||
| type = _type; | |||
| } | |||
| public String getCouponIds() { | |||
| return couponIds; | |||
| } | |||
| public void setCouponIds(String _couponIds) { | |||
| couponIds = _couponIds; | |||
| } | |||
| public Long getMechantId() { | |||
| return mechantId; | |||
| } | |||
| public void setMechantId(Long _mechantId) { | |||
| mechantId = _mechantId; | |||
| } | |||
| public Integer getSortNum() { | |||
| return sortNum; | |||
| } | |||
| public void setSortNum(Integer _sortNum) { | |||
| sortNum = _sortNum; | |||
| } | |||
| public Integer getStatus() { | |||
| return status; | |||
| } | |||
| public void setStatus(Integer _status) { | |||
| status = _status; | |||
| } | |||
| public Date getCreateTime() { | |||
| return createTime; | |||
| } | |||
| public void setCreateTime(Date _createTime) { | |||
| createTime = _createTime; | |||
| } | |||
| public Date getUpdateTime() { | |||
| return updateTime; | |||
| } | |||
| public void setUpdateTime(Date _updateTime) { | |||
| updateTime = _updateTime; | |||
| } | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||
| ,CoverImg_ASC("`coverImg` ASC"),CoverImg_DESC("`coverImg` DESC") | |||
| ,Title_ASC("`title` ASC"),Title_DESC("`title` DESC") | |||
| ,SubTitle_ASC("`subTitle` ASC"),SubTitle_DESC("`subTitle` DESC") | |||
| ,UsePrice_ASC("`usePrice` ASC"),UsePrice_DESC("`usePrice` DESC") | |||
| ,DiscountPrice_ASC("`discountPrice` ASC"),DiscountPrice_DESC("`discountPrice` DESC") | |||
| ,Detail_ASC("`detail` ASC"),Detail_DESC("`detail` DESC") | |||
| ,ValidStartDate_ASC("`validStartDate` ASC"),ValidStartDate_DESC("`validStartDate` DESC") | |||
| ,ValidEndDate_ASC("`validEndDate` ASC"),ValidEndDate_DESC("`validEndDate` DESC") | |||
| ,ImgDetail_ASC("`imgDetail` ASC"),ImgDetail_DESC("`imgDetail` DESC") | |||
| ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | |||
| ,CouponIds_ASC("`couponIds` ASC"),CouponIds_DESC("`couponIds` DESC") | |||
| ,MechantId_ASC("`mechantId` ASC"),MechantId_DESC("`mechantId` DESC") | |||
| ,SortNum_ASC("`sortNum` ASC"),SortNum_DESC("`sortNum` DESC") | |||
| ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") | |||
| ,CreateTime_ASC("`createTime` ASC"),CreateTime_DESC("`createTime` DESC") | |||
| ,UpdateTime_ASC("`updateTime` ASC"),UpdateTime_DESC("`updateTime` DESC") | |||
| ; | |||
| private String value; | |||
| Field(String value){ | |||
| this.value = value; | |||
| } | |||
| public String getValue() { | |||
| return value; | |||
| } | |||
| public void setCol(String value) { | |||
| this.value = value; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return this.getValue(); | |||
| } | |||
| } | |||
| public void setSortColumns(WxCampaign.Field... fields) | |||
| { | |||
| if (fields == null || fields.length == 0) { | |||
| return; | |||
| } | |||
| for (int k = 0; k < fields.length; k++) { | |||
| if (fields[k] == null) { | |||
| return; | |||
| } | |||
| } | |||
| StringBuilder sb = new StringBuilder(fields[0].toString()); | |||
| for (int k = 1; k < fields.length; k++) { | |||
| sb.append(","); | |||
| sb.append(fields[k].toString()); | |||
| } | |||
| } | |||
| public void setSortColumns(String sortColumns) | |||
| { | |||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||
| return; | |||
| } | |||
| if (sortColumns.contains(",")) { | |||
| String[] cols = sortColumns.split(","); | |||
| java.util.List<Field> fList = new java.util.ArrayList(); | |||
| for (int k = 0; k < cols.length; k++) { | |||
| fList.add(Field.valueOf(cols[k])); | |||
| } | |||
| this.setSortColumns(fList.toArray(new Field[fList.size()])); | |||
| } else { | |||
| this.setSortColumns(Field.valueOf(sortColumns)); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,12 +1,11 @@ | |||
| package com.simple.domain.po; | |||
| import javax.persistence.*; | |||
| import java.util.*; | |||
| import java.math.*; | |||
| import javax.persistence.Transient; | |||
| import java.util.List; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| import javax.persistence.Transient; | |||
| import java.io.Serializable; | |||
| import java.math.BigDecimal; | |||
| import java.util.List; | |||
| @Table(name = "wx_mall") | |||
| public class WxMall implements Serializable { | |||
| @@ -81,6 +80,9 @@ public class WxMall implements Serializable { | |||
| /*支付ID,参看wx_pay_account**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="支付ID,参看wx_pay_account",name="payId") | |||
| private Long payId; | |||
| @io.swagger.annotations.ApiModelProperty(value="电话",name="servicePhone") | |||
| private String servicePhone; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| @@ -160,7 +162,13 @@ public class WxMall implements Serializable { | |||
| payId = _payId; | |||
| } | |||
| public String getServicePhone() { | |||
| return servicePhone; | |||
| } | |||
| public void setServicePhone(String servicePhone) { | |||
| this.servicePhone = servicePhone; | |||
| } | |||
| public static enum Field | |||
| { | |||
| @@ -2,13 +2,13 @@ package com.simple.domain.po; | |||
| import com.simple.utils.BaseConstant; | |||
| import javax.persistence.*; | |||
| import java.util.*; | |||
| import java.math.*; | |||
| import javax.persistence.Transient; | |||
| import java.util.List; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| import javax.persistence.Transient; | |||
| import java.io.Serializable; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.UUID; | |||
| @Table(name = "wx_merchant_b_user") | |||
| public class WxMerchantBUser implements Serializable { | |||
| @@ -74,6 +74,10 @@ public class WxMerchantBUser implements Serializable { | |||
| /*用户过期时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="用户过期时间",name="expireTime") | |||
| private Date expireTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="name",name="name") | |||
| private String name; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| @@ -135,7 +139,13 @@ public class WxMerchantBUser implements Serializable { | |||
| expireTime = _expireTime; | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| public void setName(String name) { | |||
| this.name = name; | |||
| } | |||
| public static enum Field | |||
| { | |||
| @@ -150,7 +160,9 @@ public class WxMerchantBUser implements Serializable { | |||
| ,AppId_ASC("`appId` ASC"),AppId_DESC("`appId` DESC") | |||
| ,Token_ASC("`token` ASC"),Token_DESC("`token` DESC") | |||
| ,ExpireTime_ASC("`expireTime` ASC"),ExpireTime_DESC("`expireTime` DESC") | |||
| ; | |||
| ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") | |||
| ; | |||
| private String value; | |||
| Field(String value){ | |||
| this.value = value; | |||
| @@ -1,12 +1,10 @@ | |||
| package com.simple.domain.po; | |||
| import javax.persistence.*; | |||
| import java.util.*; | |||
| import java.math.*; | |||
| import javax.persistence.Transient; | |||
| import java.util.List; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| import javax.persistence.Transient; | |||
| import java.io.Serializable; | |||
| import java.util.List; | |||
| @Table(name = "wx_msg_config") | |||
| public class WxMsgConfig implements Serializable { | |||
| @@ -77,6 +75,18 @@ public class WxMsgConfig implements Serializable { | |||
| /*回调地址**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="回调地址",name="notifyurl") | |||
| private String notifyurl; | |||
| /*模板回调地址**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="模板回调地址",name="modelnotifyurl") | |||
| private String modelnotifyurl; | |||
| @io.swagger.annotations.ApiModelProperty(value="模板回调地址",name="verifynotifyurl") | |||
| private String verifynotifyurl; | |||
| @io.swagger.annotations.ApiModelProperty(value="appid",name="appid") | |||
| private String appid; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| @@ -151,6 +161,29 @@ public class WxMsgConfig implements Serializable { | |||
| } | |||
| public String getModelnotifyurl() { | |||
| return modelnotifyurl; | |||
| } | |||
| public void setModelnotifyurl(String modelnotifyurl) { | |||
| this.modelnotifyurl = modelnotifyurl; | |||
| } | |||
| public String getVerifynotifyurl() { | |||
| return verifynotifyurl; | |||
| } | |||
| public void setVerifynotifyurl(String verifynotifyurl) { | |||
| this.verifynotifyurl = verifynotifyurl; | |||
| } | |||
| public String getAppid() { | |||
| return appid; | |||
| } | |||
| public void setAppid(String appid) { | |||
| this.appid = appid; | |||
| } | |||
| public static enum Field | |||
| { | |||
| @@ -1,12 +1,11 @@ | |||
| package com.simple.domain.po; | |||
| import javax.persistence.*; | |||
| import java.util.*; | |||
| import java.math.*; | |||
| import javax.persistence.Transient; | |||
| import java.util.List; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| import javax.persistence.Transient; | |||
| import java.io.Serializable; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @Table(name = "wx_msg_model") | |||
| public class WxMsgModel implements Serializable { | |||
| @@ -59,6 +58,11 @@ public class WxMsgModel implements Serializable { | |||
| /*审核状态 0未通过 1 通过 2审核中**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="审核状态 0未通过 1 通过 2审核中",name="status") | |||
| private Integer status; | |||
| @io.swagger.annotations.ApiModelProperty(value="modelid",name="modelId") | |||
| private Integer modelId; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| @@ -96,7 +100,13 @@ public class WxMsgModel implements Serializable { | |||
| status = _status; | |||
| } | |||
| public Integer getModelId() { | |||
| return modelId; | |||
| } | |||
| public void setModelId(Integer modelId) { | |||
| this.modelId = modelId; | |||
| } | |||
| public static enum Field | |||
| { | |||
| @@ -107,7 +117,9 @@ public class WxMsgModel implements Serializable { | |||
| ,Content_ASC("`content` ASC"),Content_DESC("`content` DESC") | |||
| ,Createtime_ASC("`createtime` ASC"),Createtime_DESC("`createtime` DESC") | |||
| ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") | |||
| ; | |||
| ,ModelId_ASC("`modelId` ASC"),ModelId_DESC("`modelId` DESC") | |||
| ; | |||
| private String value; | |||
| Field(String value){ | |||
| this.value = value; | |||
| @@ -63,6 +63,10 @@ public class WxMsgValidationcode implements Serializable { | |||
| /***/ | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="code") | |||
| private String code; | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="appid") | |||
| private String appid; | |||
| public String getPhone() { | |||
| return phone; | |||
| } | |||
| @@ -112,7 +116,13 @@ public class WxMsgValidationcode implements Serializable { | |||
| code = _code; | |||
| } | |||
| public String getAppid() { | |||
| return appid; | |||
| } | |||
| public void setAppid(String appid) { | |||
| this.appid = appid; | |||
| } | |||
| public static enum Field | |||
| { | |||
| @@ -0,0 +1,189 @@ | |||
| package com.simple.domain.po; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| import javax.persistence.Transient; | |||
| import java.io.Serializable; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @Table(name = "wx_msg_validationcode_model") | |||
| public class WxMsgValidationcodeModel implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @Id | |||
| protected Long id; | |||
| @Transient | |||
| protected List<String> ids; | |||
| @Transient | |||
| protected String sortColumns; | |||
| public Long getId() { | |||
| return id; | |||
| } | |||
| public void setId(Long id) { | |||
| this.id = id; | |||
| } | |||
| public String getSortColumns() { | |||
| return sortColumns; | |||
| } | |||
| public List<String> getIds() { | |||
| return ids; | |||
| } | |||
| public void setIds(List<String> ids) { | |||
| this.ids = ids; | |||
| } | |||
| /*名称**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="名称",name="name") | |||
| private String name; | |||
| /*签名**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="签名",name="signature") | |||
| private String signature; | |||
| /***/ | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="content") | |||
| private String content; | |||
| /***/ | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="createtime") | |||
| private Date createtime; | |||
| /*审核状态 0未通过 1 通过 2审核中**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="审核状态 0未通过 1 通过 2审核中",name="status") | |||
| private Integer status; | |||
| /*有效分钟数**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="有效分钟数",name="minutes") | |||
| private Integer minutes; | |||
| /***/ | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="modelId") | |||
| private Integer modelId; | |||
| /*场景**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="场景",name="type") | |||
| private Integer type; | |||
| @io.swagger.annotations.ApiModelProperty(value="tenantid",name="tenantId") | |||
| private String tenantId; | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| public void setName(String _name) { | |||
| name = _name; | |||
| } | |||
| public String getSignature() { | |||
| return signature; | |||
| } | |||
| public void setSignature(String _signature) { | |||
| signature = _signature; | |||
| } | |||
| public String getContent() { | |||
| return content; | |||
| } | |||
| public void setContent(String _content) { | |||
| content = _content; | |||
| } | |||
| public Date getCreatetime() { | |||
| return createtime; | |||
| } | |||
| public void setCreatetime(Date _createtime) { | |||
| createtime = _createtime; | |||
| } | |||
| public Integer getStatus() { | |||
| return status; | |||
| } | |||
| public void setStatus(Integer _status) { | |||
| status = _status; | |||
| } | |||
| public Integer getMinutes() { | |||
| return minutes; | |||
| } | |||
| public void setMinutes(Integer _minutes) { | |||
| minutes = _minutes; | |||
| } | |||
| public Integer getModelId() { | |||
| return modelId; | |||
| } | |||
| public void setModelId(Integer _modelId) { | |||
| modelId = _modelId; | |||
| } | |||
| public Integer getType() { | |||
| return type; | |||
| } | |||
| public void setType(Integer _type) { | |||
| type = _type; | |||
| } | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String tenantId) { | |||
| this.tenantId = tenantId; | |||
| } | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") | |||
| ,Signature_ASC("`signature` ASC"),Signature_DESC("`signature` DESC") | |||
| ,Content_ASC("`content` ASC"),Content_DESC("`content` DESC") | |||
| ,Createtime_ASC("`createtime` ASC"),Createtime_DESC("`createtime` DESC") | |||
| ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") | |||
| ,Minutes_ASC("`minutes` ASC"),Minutes_DESC("`minutes` DESC") | |||
| ,ModelId_ASC("`modelId` ASC"),ModelId_DESC("`modelId` DESC") | |||
| ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | |||
| ; | |||
| private String value; | |||
| Field(String value){ | |||
| this.value = value; | |||
| } | |||
| public String getValue() { | |||
| return value; | |||
| } | |||
| public void setCol(String value) { | |||
| this.value = value; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return this.getValue(); | |||
| } | |||
| } | |||
| public void setSortColumns(Field... fields) | |||
| { | |||
| if (fields == null || fields.length == 0) { | |||
| return; | |||
| } | |||
| for (int k = 0; k < fields.length; k++) { | |||
| if (fields[k] == null) { | |||
| return; | |||
| } | |||
| } | |||
| StringBuilder sb = new StringBuilder(fields[0].toString()); | |||
| for (int k = 1; k < fields.length; k++) { | |||
| sb.append(","); | |||
| sb.append(fields[k].toString()); | |||
| } | |||
| } | |||
| public void setSortColumns(String sortColumns) | |||
| { | |||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||
| return; | |||
| } | |||
| if (sortColumns.contains(",")) { | |||
| String[] cols = sortColumns.split(","); | |||
| List<Field> fList = new ArrayList(); | |||
| for (int k = 0; k < cols.length; k++) { | |||
| fList.add(Field.valueOf(cols[k])); | |||
| } | |||
| this.setSortColumns(fList.toArray(new Field[fList.size()])); | |||
| } else { | |||
| this.setSortColumns(Field.valueOf(sortColumns)); | |||
| } | |||
| } | |||
| } | |||
| @@ -16,7 +16,7 @@ public class WxTags implements Serializable { | |||
| protected Long id; | |||
| @Transient | |||
| protected List<String> ids; | |||
| protected List<Long> ids; | |||
| @Transient | |||
| protected String sortColumns; | |||
| @@ -32,10 +32,10 @@ public class WxTags implements Serializable { | |||
| return sortColumns; | |||
| } | |||
| public List<String> getIds() { | |||
| public List<Long> getIds() { | |||
| return ids; | |||
| } | |||
| public void setIds(List<String> ids) { | |||
| public void setIds(List<Long> ids) { | |||
| this.ids = ids; | |||
| } | |||
| @@ -0,0 +1,30 @@ | |||
| package com.simple.domain.vo; | |||
| import java.io.Serializable; | |||
| public class WxChooseTagVo implements Serializable{ | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = -2193506530627907289L; | |||
| //tagname | |||
| private String names; | |||
| //用户数 | |||
| private Long userCount; | |||
| public String getNames() { | |||
| return names; | |||
| } | |||
| public void setNames(String names) { | |||
| this.names = names; | |||
| } | |||
| public Long getUserCount() { | |||
| return userCount; | |||
| } | |||
| public void setUserCount(Long userCount) { | |||
| this.userCount = userCount; | |||
| } | |||
| } | |||
| @@ -9,10 +9,19 @@ public class WxTagsVo implements Serializable{ | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = 1786459967532225067L; | |||
| private Long id; | |||
| private String value; | |||
| private List<WxTagsVo> subTags; | |||
| public Long getId() { | |||
| return id; | |||
| } | |||
| public void setId(Long id) { | |||
| this.id = id; | |||
| } | |||
| public String getValue() { | |||
| return value; | |||
| @@ -0,0 +1,17 @@ | |||
| package com.simple.mapper; | |||
| import com.simple.common.CommonMapper; | |||
| import com.simple.domain.po.CouponInject; | |||
| import java.util.List; | |||
| public interface CouponInjectMapper extends CommonMapper<CouponInject, Long> { | |||
| List<CouponInject> findList(CouponInject couponInject); | |||
| } | |||
| @@ -1,17 +1,16 @@ | |||
| package com.simple.mapper; | |||
| import java.util.*; | |||
| import java.util.List; | |||
| import com.simple.common.CommonMapper; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import com.simple.domain.po.WxCUserTags; | |||
| public interface WxCUserTagsMapper extends CommonMapper<WxCUserTags, String> { | |||
| List<WxCUserTags> findList(WxCUserTags wxCUserTags); | |||
| long findCountByTag(List<Long> tagIds); | |||
| List<Long> findUserByTag(List<Long> tagIds); | |||
| } | |||
| @@ -0,0 +1,19 @@ | |||
| package com.simple.mapper; | |||
| import com.simple.common.CommonMapper; | |||
| import com.simple.domain.po.WxCampaign; | |||
| import java.util.List; | |||
| public interface WxCampaignMapper extends CommonMapper<WxCampaign, Long> { | |||
| List<WxCampaign> findList(WxCampaign wxCampaign); | |||
| int getMaxSortNum(String tenantId); | |||
| } | |||
| @@ -9,7 +9,7 @@ public interface WxDateAmountRecordMapper extends CommonMapper<WxDateAmountRecor | |||
| List<WxDateAmountRecord> findList(WxDateAmountRecord wxDateAmountRecord); | |||
| int updateAmount(WxDateAmountRecord wxDateAmountRecord); | |||
| @@ -0,0 +1,17 @@ | |||
| package com.simple.mapper; | |||
| import java.util.*; | |||
| import com.simple.common.CommonMapper; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import com.simple.domain.po.WxMsgValidationcodeModel; | |||
| public interface WxMsgValidationcodeModelMapper extends CommonMapper<WxMsgValidationcodeModel, String> { | |||
| List<WxMsgValidationcodeModel> findList(WxMsgValidationcodeModel wxMsgValidationcodeModel); | |||
| } | |||
| @@ -34,11 +34,11 @@ public class WxProfitSharing { | |||
| /** | |||
| * 分账查询 | |||
| * @param params 请求参数 | |||
| * @param params | |||
| * @return | |||
| */ | |||
| public static String queryOrder(Map<String, String> params) { | |||
| return doPost(PROFIT_SHARING_URL, params); | |||
| return doPost(PROFIT_SHARING_QUERY_URL, params); | |||
| } | |||
| @@ -0,0 +1,63 @@ | |||
| package com.simple.pay; | |||
| import java.io.Serializable; | |||
| /** | |||
| * Created by Peng on 2018/8/10. | |||
| */ | |||
| public class WxProfitSharingQueryP implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| private String mch_id; // 商户号 | |||
| private String sub_mch_id; // 子商户号 | |||
| private String nonce_str; // 随机字符串 | |||
| private String sign; // 签名 | |||
| private String transaction_id ; // 支付订单号 | |||
| private String out_trade_no; // 商户分账单号 | |||
| public String getMch_id() { | |||
| return mch_id; | |||
| } | |||
| public void setMch_id(String mch_id) { | |||
| this.mch_id = mch_id; | |||
| } | |||
| public String getSub_mch_id() { return sub_mch_id; } | |||
| public void setSub_mch_id(String sub_mch_id) { | |||
| this.sub_mch_id = sub_mch_id; | |||
| } | |||
| public String getNonce_str() { | |||
| return nonce_str; | |||
| } | |||
| public void setNonce_str(String nonce_str) { | |||
| this.nonce_str = nonce_str; | |||
| } | |||
| public String getSign() { | |||
| return sign; | |||
| } | |||
| public void setSign(String sign) { | |||
| this.sign = sign; | |||
| } | |||
| public String getTransaction_id() { | |||
| return transaction_id; | |||
| } | |||
| public void setTransaction_id(String transaction_id) { | |||
| this.transaction_id = transaction_id; | |||
| } | |||
| public String getOut_trade_no() { return out_trade_no; } | |||
| public void setOut_trade_no(String out_trade_no) { | |||
| this.out_trade_no = out_trade_no; | |||
| } | |||
| } | |||
| @@ -0,0 +1,53 @@ | |||
| package com.simple.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.po.CouponInject; | |||
| public interface CouponInjectService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param offset | |||
| * @param limit | |||
| * @return | |||
| */ | |||
| PageInfo<CouponInject> listAsPage(CouponInject record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| CouponInject getById(Long id); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(CouponInject record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void add(CouponInject record); | |||
| } | |||
| @@ -1,8 +1,11 @@ | |||
| package com.simple.service; | |||
| import java.util.*; | |||
| import java.util.List; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.po.WxCUser; | |||
| import com.simple.domain.po.WxCUserTags; | |||
| import com.simple.domain.vo.WxChooseTagVo; | |||
| public interface WxCUserTagsService { | |||
| @@ -38,11 +41,26 @@ public interface WxCUserTagsService { | |||
| */ | |||
| void deleteById(Long id); | |||
| /** | |||
| * tagIds查询 用户数量 | |||
| * @param tagIds | |||
| * @return | |||
| */ | |||
| long findCountByTag(List<Long> tagIds); | |||
| /** | |||
| * | |||
| * tagIds查询用户user信息集合 | |||
| * @param tagIds | |||
| * @return | |||
| */ | |||
| List<WxCUser> findUserByTag(List<Long> tagIds); | |||
| /** | |||
| * 获取用户数量和tags name | |||
| * @param tagIds | |||
| * @return | |||
| */ | |||
| WxChooseTagVo findChooseTag(List<Long> tagIds); | |||
| } | |||
| @@ -0,0 +1,48 @@ | |||
| package com.simple.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.po.WxCampaign; | |||
| public interface WxCampaignService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param offset | |||
| * @param limit | |||
| * @return | |||
| */ | |||
| PageInfo<WxCampaign> listAsPage(WxCampaign record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxCampaign getById(Long id); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(WxCampaign record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| int getMaxSortNum(String tenantId); | |||
| } | |||
| @@ -34,6 +34,13 @@ public interface WxCouponOrderService { | |||
| */ | |||
| void saveOrUpdate(WxCouponOrder record); | |||
| /** | |||
| * 返回id | |||
| * @param record | |||
| * @return | |||
| */ | |||
| Long insertOne(WxCouponOrder record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| @@ -26,6 +26,13 @@ public interface WxCouponService { | |||
| * @return | |||
| */ | |||
| PageInfo<WxCoupon> findEnableList(WxCoupon record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 不分页 | |||
| * @param record | |||
| * @return | |||
| */ | |||
| List<WxCoupon> findList(WxCoupon record); | |||
| /** | |||
| * 根据Id获得实体 | |||
| @@ -38,8 +38,16 @@ public interface WxDateAmountRecordService { | |||
| */ | |||
| void deleteById(Long id); | |||
| /** | |||
| * 修改交易核销 | |||
| * @param tenantId 租户id | |||
| * @param merchantId 商户id | |||
| * @param type 类型 0 交易记录 1.核销记录 | |||
| * @param payPrice 金额 | |||
| * @return | |||
| */ | |||
| int updateAmount(String tenantId,Long merchantId | |||
| ,Integer type,Integer payPrice); | |||
| @@ -37,8 +37,13 @@ public interface WxMallService { | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| /** | |||
| * 根据tenant Id查寻 | |||
| * | |||
| * @param id | |||
| */ | |||
| WxMall getByTenantId(String id); | |||
| @@ -1,7 +1,7 @@ | |||
| package com.simple.service; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxMerchantBUser; | |||
| public interface WxMerchantBUserService { | |||
| @@ -31,13 +31,21 @@ public interface WxMerchantBUserService { | |||
| * @return | |||
| */ | |||
| WxMerchantBUser getByToken(String token); | |||
| /** | |||
| * 根据appId,phone获得实体 | |||
| * | |||
| * @param record | |||
| * @return | |||
| */ | |||
| WxMerchantBUser getBUserByAppId(WxMerchantBUser record); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(WxMerchantBUser record); | |||
| Long saveOrUpdate(WxMerchantBUser record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| @@ -45,12 +53,10 @@ public interface WxMerchantBUserService { | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| boolean hasphone(String phone); | |||
| ResultData updatepwd(String phone, String code, String pwd); | |||
| } | |||
| @@ -1,20 +1,29 @@ | |||
| package com.simple.service; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.po.WxMerchant; | |||
| import java.util.List; | |||
| public interface WxMerchantService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param offset | |||
| * @param limit | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxMerchant> listAsPage(WxMerchant record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @return | |||
| */ | |||
| List<WxMerchant> etcpList(WxMerchant record); | |||
| /** | |||
| * 根据Id获得实体 | |||
| @@ -29,7 +38,7 @@ public interface WxMerchantService { | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(WxMerchant record); | |||
| void saveOrUpdate(WxMerchant record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| @@ -40,4 +40,9 @@ public interface WxMsgCallbackService { | |||
| void saveOrUpdate(String bid, String item, String sign); | |||
| void receivemodel(String bid, Map<String,String> param); | |||
| void receiveverifymodel(String bid, Map<String,String> param); | |||
| } | |||
| @@ -41,7 +41,7 @@ public interface WxMsgModelService { | |||
| ResultData getmodellist(); | |||
| ResultData getmodellist(String tenantId); | |||
| @@ -0,0 +1,49 @@ | |||
| package com.simple.service; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxMsgValidationcodeModel; | |||
| public interface WxMsgValidationcodeModelService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param offset | |||
| * @param limit | |||
| * @return | |||
| */ | |||
| PageInfo<WxMsgValidationcodeModel> listAsPage(WxMsgValidationcodeModel record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxMsgValidationcodeModel getById(String id); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| ResultData saveOrUpdate(WxMsgValidationcodeModel record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(String id); | |||
| } | |||
| @@ -44,6 +44,14 @@ public interface WxOrderService { | |||
| */ | |||
| WxOrder saveOrder(WxCUser user, Long couponId); | |||
| /** | |||
| * 免费券订单接口 | |||
| * @param userId | |||
| * @param couponId | |||
| * @return 订单id | |||
| */ | |||
| WxOrder sendUserFreeCoupon(Long userId, Long couponId); | |||
| /** | |||
| * 更新订单状态 | |||
| * @param orderId | |||
| @@ -50,9 +50,12 @@ public interface WxProfitSharingOrderService { | |||
| /** | |||
| * 创建分账订单 | |||
| */ | |||
| public ResultData createSharingOrder(WxAppinfo appInfo, WxPayOrder wxPayOrder); | |||
| public ResultData createSharingOrder(WxPayOrder wxPayOrder); | |||
| /** | |||
| * 查询分账订单 | |||
| */ | |||
| public ResultData querySharingOrder(WxPayOrder wxPayOrder); | |||
| } | |||
| @@ -0,0 +1,127 @@ | |||
| package com.simple.service.impl; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.IdWorker; | |||
| import com.simple.domain.po.*; | |||
| import com.simple.mapper.CouponInjectMapper; | |||
| import com.simple.service.CouponInjectService; | |||
| import com.simple.service.WxCUserTagsService; | |||
| import com.simple.service.WxCouponOrderService; | |||
| import com.simple.service.WxCouponService; | |||
| import org.apache.commons.lang.time.DateUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.ArrayList; | |||
| import java.util.Arrays; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @Service | |||
| public class CouponInjectServiceImpl implements CouponInjectService { | |||
| @Autowired | |||
| CouponInjectMapper couponInjectMapper; | |||
| @Autowired | |||
| WxCouponOrderService wxCouponOrderService; | |||
| @Autowired | |||
| WxCouponService wxCouponService; | |||
| @Autowired | |||
| WxCUserTagsService wxCUserTagsService; | |||
| @Override | |||
| public PageInfo<CouponInject> listAsPage(CouponInject record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> couponInjectMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public CouponInject getById(Long id) { | |||
| return couponInjectMapper.selectByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(CouponInject record) { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| final IdWorker idWorker = new IdWorker(0, 0); | |||
| record.setId(idWorker.nextId()); | |||
| couponInjectMapper.insertSelective(record); | |||
| } else { | |||
| couponInjectMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| couponInjectMapper.deleteByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public void add(CouponInject record) { | |||
| WxCoupon wxCoupon = wxCouponService.getById(record.getCouponId()); | |||
| if (wxCoupon.getValidType() == 1) { //时间范围 | |||
| if (new Date().after(wxCoupon.getValidEndDate())) { | |||
| return; | |||
| } | |||
| } | |||
| String[] arys = record.getTags().split(","); | |||
| List<Long> tagids = new ArrayList<>(); | |||
| for (int i = 0; i < arys.length; i++) { | |||
| tagids.add(Long.parseLong(arys[i])); | |||
| } | |||
| record.setTags(JSON.toJSONString(arys)); | |||
| final IdWorker idWorker = new IdWorker(0, 0); | |||
| record.setId(idWorker.nextId()); | |||
| if(record.getSendType()==0){ | |||
| record.setStatus(1); | |||
| record.setSendTime(new Date()); | |||
| }else{ | |||
| record.setStatus(0); | |||
| } | |||
| List<WxCUser> cUsers = wxCUserTagsService.findUserByTag(tagids); | |||
| record.setSendAmount(cUsers.size()); | |||
| couponInjectMapper.insertSelective(record); | |||
| if(record.getSendType()==0) { | |||
| sendNow(wxCoupon,cUsers); | |||
| } | |||
| } | |||
| private void sendNow(WxCoupon wxCoupon,List<WxCUser> cUsers){ | |||
| //查询标签用户 | |||
| for (WxCUser tempCUser : cUsers) { | |||
| sendCouponToUser(tempCUser,wxCoupon); | |||
| } | |||
| } | |||
| private void sendCouponToUser(WxCUser tempCUser,WxCoupon wxCoupon){ | |||
| try { | |||
| WxCouponOrder wxCouponOrder = new WxCouponOrder(); | |||
| wxCouponOrder.setCouponId(wxCoupon.getId()); | |||
| wxCouponOrder.setCouponOrderStatus(0); | |||
| wxCouponOrder.setCUserId(tempCUser.getId()); | |||
| wxCouponOrder.setCouponPrice(0); | |||
| wxCouponOrder.setCreateDate(new Date()); | |||
| if (wxCoupon.getValidType() == 1) { //时间范围区间 | |||
| wxCouponOrder.setExpiredTime(wxCoupon.getValidEndDate()); | |||
| } else { | |||
| Date date = DateUtils.addDays(new Date(), wxCoupon.getValidDays()); | |||
| wxCouponOrder.setExpiredTime(date); | |||
| } | |||
| wxCouponOrder.setTenantId(wxCoupon.getTenantId()); | |||
| wxCouponOrderService.saveOrUpdate(wxCouponOrder); | |||
| //短信通知 | |||
| }catch (Exception e){ | |||
| throw e; | |||
| } | |||
| } | |||
| } | |||
| @@ -1,20 +1,36 @@ | |||
| package com.simple.service.impl; | |||
| import java.util.*; | |||
| import java.util.ArrayList; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.IdWorker; | |||
| import com.simple.domain.po.WxCUser; | |||
| import com.simple.domain.po.WxCUserTags; | |||
| import com.simple.domain.po.WxTags; | |||
| import com.simple.domain.vo.WxChooseTagVo; | |||
| import com.simple.mapper.WxCUserMapper; | |||
| import com.simple.mapper.WxCUserTagsMapper; | |||
| import com.simple.mapper.WxTagsMapper; | |||
| import com.simple.service.WxCUserTagsService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import com.simple.common.IdWorker; | |||
| @Service | |||
| public class WxCUserTagsServiceImpl implements WxCUserTagsService { | |||
| @Autowired | |||
| WxCUserTagsMapper wxCUserTagsMapper; | |||
| @Autowired | |||
| WxCUserMapper wxCUserMapper; | |||
| @Autowired | |||
| WxTagsMapper wxTagsMapper; | |||
| @Override | |||
| @@ -43,11 +59,41 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { | |||
| public void deleteById(Long id) { | |||
| wxCUserTagsMapper.deleteByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public long findCountByTag(List<Long> tagIds) { | |||
| return wxCUserTagsMapper.findCountByTag(tagIds); | |||
| } | |||
| @Override | |||
| public List<WxCUser> findUserByTag(List<Long> tagIds) { | |||
| List<Long> userIds = wxCUserTagsMapper.findUserByTag(tagIds); | |||
| if(userIds.size()==0) { | |||
| return new ArrayList<>(); | |||
| } | |||
| WxCUser wxCUser = new WxCUser(); | |||
| wxCUser.setIds(userIds); | |||
| return wxCUserMapper.findList(wxCUser); | |||
| } | |||
| @Override | |||
| public WxChooseTagVo findChooseTag(List<Long> tagIds) { | |||
| WxTags wxTags =new WxTags(); | |||
| wxTags.setIds(tagIds); | |||
| List<WxTags> list = wxTagsMapper.findList(wxTags); | |||
| StringBuffer names= new StringBuffer(); | |||
| for(WxTags t:list) { | |||
| names.append(t.getName()+"/"); | |||
| } | |||
| String endName=""; | |||
| if(names.length()>0) { | |||
| endName = names.toString().substring(0,names.length()-1); | |||
| } | |||
| WxChooseTagVo vo =new WxChooseTagVo(); | |||
| vo.setNames(endName); | |||
| vo.setUserCount(findCountByTag(tagIds)); | |||
| return vo; | |||
| } | |||
| @@ -0,0 +1,52 @@ | |||
| package com.simple.service.impl; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.IdWorker; | |||
| import com.simple.domain.po.WxCampaign; | |||
| import com.simple.mapper.WxCampaignMapper; | |||
| import com.simple.service.WxCampaignService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| @Service | |||
| public class WxCampaignServiceImpl implements WxCampaignService { | |||
| @Autowired | |||
| WxCampaignMapper wxCampaignMapper; | |||
| @Override | |||
| public PageInfo<WxCampaign> listAsPage(WxCampaign record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCampaignMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public WxCampaign getById(Long id) { | |||
| return wxCampaignMapper.selectByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(WxCampaign record) { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| IdWorker idWorker = new IdWorker(0, 0); | |||
| record.setId(idWorker.nextId()); | |||
| wxCampaignMapper.insertSelective(record); | |||
| } else { | |||
| wxCampaignMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| wxCampaignMapper.deleteByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public int getMaxSortNum(String tenantId) { | |||
| return wxCampaignMapper.getMaxSortNum(tenantId); | |||
| } | |||
| } | |||
| @@ -60,6 +60,14 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| } | |||
| } | |||
| @Override | |||
| public Long insertOne(WxCouponOrder record) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| wxCouponOrderMapper.insertSelective(record); | |||
| return record.getId(); | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| wxCouponOrderMapper.deleteByPrimaryKey(id); | |||
| @@ -125,18 +133,24 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); | |||
| } | |||
| WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectByPrimaryKey(bUserId.longValue()); | |||
| if(wxMerchantBUser == null){ | |||
| logger.error("操作员ID不存在:"+ bUserId); | |||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); | |||
| } | |||
| WxOrder wxOrder = wxOrderMapper.selectByPrimaryKey(wxCouponOrder.getOrderId()); | |||
| if (!wxOrder.getMerchantId().equals(wxMerchantBUser.getMerchantId())){ | |||
| logger.error("券: couponMerchantId-" + wxOrder.getMerchantId()+"核销: couponMerchantId-"+wxMerchantBUser.getMerchantId()); | |||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); | |||
| if(bUserId != wxCouponOrder.getCUserId()) { | |||
| // TODO web管理端退款 | |||
| // B端用户退款 | |||
| WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectByPrimaryKey(bUserId.longValue()); | |||
| if (wxMerchantBUser == null) { | |||
| logger.error("操作员ID不存在:" + bUserId); | |||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); | |||
| } | |||
| if (!wxOrder.getMerchantId().equals(wxMerchantBUser.getMerchantId())) { | |||
| logger.error("券: couponMerchantId-" + wxOrder.getMerchantId() + "核销: couponMerchantId-" + wxMerchantBUser.getMerchantId()); | |||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); | |||
| } | |||
| } else { | |||
| logger.info("自己发起退款, userId: " + bUserId); | |||
| } | |||
| if (wxCouponOrder.getCouponOrderStatus().equals(EnumCouponOrderStatus.COUPON_ORDER_OVER_TIME.getCode())) { | |||
| logger.error("已过期: couponOrder-" + couponOrderId); | |||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_OVER_TIME); | |||
| @@ -28,6 +28,11 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponMapper.findEnableList(record)); | |||
| } | |||
| @Override | |||
| public List<WxCoupon> findList(WxCoupon record) { | |||
| return wxCouponMapper.findList(record); | |||
| } | |||
| @Override | |||
| public WxCoupon getById(Long id) { | |||
| return wxCouponMapper.selectByPrimaryKey(id); | |||
| @@ -43,12 +43,24 @@ public class WxDateAmountRecordServiceImpl implements WxDateAmountRecordService | |||
| public void deleteById(Long id) { | |||
| wxDateAmountRecordMapper.deleteByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public int updateAmount(String tenantId, Long merchantId, Integer type, Integer payPrice) { | |||
| Date now = new Date(); | |||
| Calendar cal1 = Calendar.getInstance(); | |||
| cal1.setTime(now); // 将时分秒,毫秒域清零 | |||
| cal1.set(Calendar.HOUR_OF_DAY, 0); | |||
| cal1.set(Calendar.MINUTE, 0); | |||
| cal1.set(Calendar.SECOND, 0); | |||
| cal1.set(Calendar.MILLISECOND, 0); | |||
| now = cal1.getTime(); | |||
| WxDateAmountRecord r = new WxDateAmountRecord(); | |||
| r.setDate(now); | |||
| r.setTenantId(tenantId); | |||
| r.setMerchantId(merchantId); | |||
| r.setType(type); | |||
| r.setPayPrice(payPrice); | |||
| return wxDateAmountRecordMapper.updateAmount(r); | |||
| } | |||
| } | |||
| @@ -45,9 +45,17 @@ public class WxMallServiceImpl implements WxMallService { | |||
| public void deleteById(Long id) { | |||
| wxMallMapper.deleteByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public WxMall getByTenantId(String id) { | |||
| WxMall wxMall = new WxMall(); | |||
| wxMall.setTenantId(id); | |||
| try { | |||
| return wxMallMapper.findList(wxMall).get(0); | |||
| } catch (Exception e){ | |||
| return null; | |||
| } | |||
| } | |||
| @@ -1,10 +1,15 @@ | |||
| package com.simple.service.impl; | |||
| import java.util.*; | |||
| import java.util.stream.Collectors; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxMerchantBUser; | |||
| import com.simple.domain.po.WxMsgValidationcode; | |||
| import com.simple.mapper.WxMerchantBUserMapper; | |||
| import com.simple.mapper.WxMsgValidationcodeMapper; | |||
| import com.simple.service.WxMerchantBUserService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| @@ -16,6 +21,8 @@ public class WxMerchantBUserServiceImpl implements WxMerchantBUserService { | |||
| @Autowired | |||
| WxMerchantBUserMapper wxMerchantBUserMapper; | |||
| @Autowired | |||
| WxMsgValidationcodeMapper wxMsgValidationcodeMapper; | |||
| @Override | |||
| public PageInfo<WxMerchantBUser> listAsPage(WxMerchantBUser record, Integer pageIndex, Integer pageSize) { | |||
| @@ -27,13 +34,18 @@ public class WxMerchantBUserServiceImpl implements WxMerchantBUserService { | |||
| return wxMerchantBUserMapper.selectByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public WxMerchantBUser getBUserByAppId(WxMerchantBUser record) { | |||
| return wxMerchantBUserMapper.selectOne(record); | |||
| } | |||
| @Override | |||
| public WxMerchantBUser getByToken(String token) { | |||
| return wxMerchantBUserMapper.findByToken(token); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(WxMerchantBUser record) { | |||
| public Long saveOrUpdate(WxMerchantBUser record) { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| @@ -44,10 +56,12 @@ public class WxMerchantBUserServiceImpl implements WxMerchantBUserService { | |||
| record.setCreateDate(date); | |||
| record.setUpdateDate(date); | |||
| wxMerchantBUserMapper.insertSelective(record); | |||
| return id; | |||
| } else { | |||
| Date date = new Date(); | |||
| record.setUpdateDate(date); | |||
| wxMerchantBUserMapper.updateByPrimaryKeySelective(record); | |||
| return record.getId(); | |||
| } | |||
| } | |||
| @@ -55,12 +69,38 @@ public class WxMerchantBUserServiceImpl implements WxMerchantBUserService { | |||
| public void deleteById(Long id) { | |||
| wxMerchantBUserMapper.deleteByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public boolean hasphone(String phone) { | |||
| WxMerchantBUser bUser = new WxMerchantBUser(); | |||
| bUser.setPhone(phone); | |||
| List<WxMerchantBUser> list = wxMerchantBUserMapper.findList(bUser); | |||
| return list.size()>=1?true:false; | |||
| } | |||
| @Override | |||
| public ResultData updatepwd(String phone, String code, String pwd) { | |||
| WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); | |||
| wxMsgValidationcode.setPhone(phone); | |||
| wxMsgValidationcode.setCode(code); | |||
| List<WxMsgValidationcode> wxmsgvalidationcodelist = wxMsgValidationcodeMapper.findList(wxMsgValidationcode); | |||
| Date currentdate = new Date(); | |||
| wxmsgvalidationcodelist = wxmsgvalidationcodelist.stream().filter(validationcode -> | |||
| validationcode.getExpiretime().after(currentdate)).collect(Collectors.toList()); | |||
| if(wxmsgvalidationcodelist.size()>0){ | |||
| //更新 | |||
| WxMerchantBUser bUser = new WxMerchantBUser(); | |||
| bUser.setPhone(phone); | |||
| List<WxMerchantBUser> list = wxMerchantBUserMapper.findList(bUser); | |||
| if(list.size()>0){ | |||
| bUser = list.get(0); | |||
| bUser.setBUserPwd(pwd); | |||
| wxMerchantBUserMapper.updateByPrimaryKeySelective(bUser); | |||
| return new ResultData(200,"操作成功"); | |||
| } | |||
| } | |||
| return new ResultData(500,"操作失败"); | |||
| } | |||
| } | |||
| @@ -4,10 +4,12 @@ import com.alibaba.fastjson.JSONArray; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.IdWorker; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxMerchant; | |||
| import com.simple.domain.po.WxMerchantBUser; | |||
| import com.simple.domain.po.WxMerchantShop; | |||
| import com.simple.domain.po.WxShop; | |||
| import com.simple.enums.EnumCarVendor; | |||
| import com.simple.mapper.WxMerchantBUserMapper; | |||
| import com.simple.mapper.WxMerchantMapper; | |||
| import com.simple.mapper.WxMerchantShopMapper; | |||
| @@ -20,6 +22,8 @@ import org.springframework.transaction.annotation.Transactional; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.stream.Collectors; | |||
| @Service | |||
| public class WxMerchantServiceImpl implements WxMerchantService { | |||
| @@ -41,6 +45,12 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public List<WxMerchant> etcpList(WxMerchant record) { | |||
| record.setCarVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||
| return wxMerchantMapper.findList(record); | |||
| } | |||
| @Override | |||
| public WxMerchant getById(Long id) { | |||
| WxMerchant wxMerchant = wxMerchantMapper.selectByPrimaryKey(id); | |||
| @@ -81,10 +91,10 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| @Override | |||
| public void saveOrUpdate(WxMerchant wxMerchant) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| long merchantid = idWorker.nextId(); | |||
| if (wxMerchant.getId() == null) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| long merchantid = idWorker.nextId(); | |||
| wxMerchant.setId(merchantid); | |||
| Date date = new Date(); | |||
| wxMerchant.setStatus(1); | |||
| @@ -114,21 +124,6 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| WxShopMapper.updateByPrimaryKeySelective(wxShop); | |||
| } | |||
| //保存商户关联用户 | |||
| List<Long> useridlist = wxMerchant.getUserids(); | |||
| for(Long userid:useridlist){ | |||
| WxMerchantBUser wxMerchantBUser = new WxMerchantBUser(); | |||
| wxMerchantBUser.setId(userid); | |||
| List<WxMerchantBUser> buserlist = wxMerchantBUserMapper.findList(wxMerchantBUser); | |||
| if(buserlist.size()>0){ | |||
| wxMerchantBUser = buserlist.get(0); | |||
| wxMerchantBUser.setMerchantId(merchantid); | |||
| wxMerchantBUser.setUpdateDate(new Date()); | |||
| wxMerchantBUserMapper.updateByPrimaryKey(wxMerchantBUser); | |||
| } | |||
| } | |||
| } else { | |||
| //更新商户 | |||
| @@ -151,7 +146,6 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| WxShopMapper.updateByPrimaryKeySelective(wxShop); | |||
| } | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| //保存商户商铺的关联 | |||
| List<Long> shopidlist = wxMerchant.getShopids(); | |||
| for(Long shopid:shopidlist){ | |||
| @@ -174,21 +168,25 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| WxShopMapper.updateByPrimaryKeySelective(wxShop); | |||
| } | |||
| } | |||
| //保存商户关联用户 | |||
| List<Long> useridlist = wxMerchant.getUserids(); | |||
| for(Long userid:useridlist){ | |||
| WxMerchantBUser wxMerchantBUser = new WxMerchantBUser(); | |||
| wxMerchantBUser.setId(userid); | |||
| List<WxMerchantBUser> buserlist = wxMerchantBUserMapper.findList(wxMerchantBUser); | |||
| if(buserlist.size()>0){ | |||
| wxMerchantBUser = buserlist.get(0); | |||
| wxMerchantBUser.setMerchantId(wxMerchant.getId()); | |||
| wxMerchantBUser.setUpdateDate(new Date()); | |||
| wxMerchantBUserMapper.updateByPrimaryKey(wxMerchantBUser); | |||
| } | |||
| } | |||
| //删除之前的关联用户 | |||
| List<WxMerchantBUser> bUsers = wxMerchant.getbUsers(); | |||
| for(WxMerchantBUser user:bUsers){ | |||
| wxMerchantBUserMapper.deleteByPrimaryKey(user.getId()); | |||
| } | |||
| //保存商户关联用户 | |||
| for(WxMerchantBUser user:bUsers){ | |||
| long id = idWorker.nextId(); | |||
| user.setId(id); | |||
| user.setBUserId(id); | |||
| user.setMerchantId(merchantid); | |||
| Date date = new Date(); | |||
| user.setCreateDate(date); | |||
| user.setUpdateDate(date); | |||
| wxMerchantBUserMapper.insertSelective(user); | |||
| } | |||
| @@ -6,15 +6,19 @@ import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.IdWorker; | |||
| import com.simple.domain.po.WxMsgCallback; | |||
| import com.simple.domain.po.WxMsgConfig; | |||
| import com.simple.domain.po.WxMsgModel; | |||
| import com.simple.domain.po.WxMsgValidationcodeModel; | |||
| import com.simple.mapper.WxMsgCallbackMapper; | |||
| import com.simple.mapper.WxMsgConfigMapper; | |||
| import com.simple.mapper.WxMsgModelMapper; | |||
| import com.simple.mapper.WxMsgValidationcodeModelMapper; | |||
| import com.simple.service.WxMsgCallbackService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.UUID; | |||
| import java.util.Map; | |||
| @Service | |||
| public class WxMsgCallbackServiceImpl implements WxMsgCallbackService { | |||
| @@ -25,6 +29,13 @@ public class WxMsgCallbackServiceImpl implements WxMsgCallbackService { | |||
| @Autowired | |||
| WxMsgConfigMapper wxMsgConfigMapper; | |||
| @Autowired | |||
| WxMsgModelMapper wxMsgModelMapper; | |||
| @Autowired | |||
| WxMsgValidationcodeModelMapper wxMsgValidationcodeModelMapper; | |||
| @Override | |||
| public PageInfo<WxMsgCallback> listAsPage(WxMsgCallback record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMsgCallbackMapper.findList(record)); | |||
| @@ -56,7 +67,6 @@ public class WxMsgCallbackServiceImpl implements WxMsgCallbackService { | |||
| WxMsgConfig wxMsgConfig = new WxMsgConfig(); | |||
| wxMsgConfig.setBid(bid); | |||
| String tenantid=null; | |||
| List<WxMsgConfig> list = wxMsgConfigMapper.findList(wxMsgConfig); | |||
| if(list.size()==1) { | |||
| List<WxMsgCallback> wxMsgCallbacks = JSONArray.parseArray(item, WxMsgCallback.class); | |||
| @@ -65,7 +75,7 @@ public class WxMsgCallbackServiceImpl implements WxMsgCallbackService { | |||
| wxMsgConfigMapper.updateByPrimaryKeySelective(wxMsgConfig); | |||
| for (WxMsgCallback wxMsgCallback : wxMsgCallbacks) { | |||
| wxMsgCallback.setTenantId(tenantid); | |||
| wxMsgCallback.setTenantId(wxMsgConfig.getTenantId()); | |||
| wxMsgCallback.setSign(sign); | |||
| wxMsgCallback.setCreatetime(new Date()); | |||
| wxMsgCallbackMapper.insertSelective(wxMsgCallback); | |||
| @@ -73,5 +83,37 @@ public class WxMsgCallbackServiceImpl implements WxMsgCallbackService { | |||
| } | |||
| } | |||
| @Override | |||
| public void receivemodel(String bid, Map<String, String> param) { | |||
| WxMsgConfig wxMsgConfig = new WxMsgConfig(); | |||
| wxMsgConfig.setBid(bid); | |||
| List<WxMsgConfig> list = wxMsgConfigMapper.findList(wxMsgConfig); | |||
| if(list.size()==1) { | |||
| WxMsgModel wxMsgModel = new WxMsgModel(); | |||
| wxMsgModel.setModelId(Integer.valueOf(param.get("id"))); | |||
| wxMsgModel = wxMsgModelMapper.findList(wxMsgModel).get(0); | |||
| wxMsgModel.setStatus(param.get("status").equals("1")?Integer.valueOf(param.get("status")):0); | |||
| wxMsgModelMapper.updateByPrimaryKeySelective(wxMsgModel); | |||
| } | |||
| } | |||
| @Override | |||
| public void receiveverifymodel(String bid, Map<String, String> param) { | |||
| WxMsgConfig wxMsgConfig = new WxMsgConfig(); | |||
| wxMsgConfig.setBid(bid); | |||
| List<WxMsgConfig> list = wxMsgConfigMapper.findList(wxMsgConfig); | |||
| if(list.size()==1) { | |||
| WxMsgValidationcodeModel wxMsgModel = new WxMsgValidationcodeModel(); | |||
| wxMsgModel.setModelId(Integer.valueOf(param.get("id"))); | |||
| wxMsgModel = wxMsgValidationcodeModelMapper.findList(wxMsgModel).get(0); | |||
| wxMsgModel.setStatus(param.get("status").equals("1")?Integer.valueOf(param.get("status")):0); | |||
| wxMsgValidationcodeModelMapper.updateByPrimaryKeySelective(wxMsgModel); | |||
| } | |||
| } | |||
| } | |||
| @@ -42,11 +42,9 @@ public class WxMsgModelServiceImpl implements WxMsgModelService { | |||
| @Override | |||
| public ResultData saveOrUpdate(WxMsgModel wxMsgModel) { | |||
| String tenantid="1"; | |||
| //从短信配置中查询密钥 bid 等信息 | |||
| WxMsgConfig wxMsgConfig = new WxMsgConfig(); | |||
| wxMsgConfig.setTenantId(tenantid); | |||
| wxMsgConfig.setTenantId(wxMsgModel.getTenantId()); | |||
| List<WxMsgConfig> wxMsgConfigs = wxMsgConfigMapper.findList(wxMsgConfig); | |||
| if(wxMsgConfigs.size()==0)return new ResultData(Result.SUCCESS, "您还未接入短信运营商,请联系平台管理员"); | |||
| wxMsgConfig = wxMsgConfigs.get(0); | |||
| @@ -72,6 +70,7 @@ public class WxMsgModelServiceImpl implements WxMsgModelService { | |||
| message.put("bid", bid); | |||
| message.put("signature", signature); | |||
| message.put("content", content); | |||
| message.put("notify_url",wxMsgConfig.getModelnotifyurl()); | |||
| StringBuilder sb = new StringBuilder(); | |||
| Set<Map.Entry<String, String>> entries = message.entrySet(); | |||
| @@ -105,8 +104,11 @@ public class WxMsgModelServiceImpl implements WxMsgModelService { | |||
| if (wxMsgModel.getId() == null) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| wxMsgModel.setId(idWorker.nextId()); | |||
| wxMsgModel.setTenantId(tenantid); | |||
| wxMsgModel.setTenantId(wxMsgModel.getTenantId()); | |||
| String data = jsonObjectResult.get("data").toString(); | |||
| wxMsgModel.setModelId(Integer.valueOf(data)); | |||
| wxMsgModel.setCreatetime(new Date()); | |||
| wxMsgModel.setStatus(2);//审核中 | |||
| wxMsgModelMapper.insertSelective(wxMsgModel); | |||
| } else { | |||
| wxMsgModelMapper.updateByPrimaryKeySelective(wxMsgModel); | |||
| @@ -124,9 +126,10 @@ public class WxMsgModelServiceImpl implements WxMsgModelService { | |||
| } | |||
| @Override | |||
| public ResultData getmodellist() { | |||
| public ResultData getmodellist(String tenantId) { | |||
| WxMsgModel wxMsgModel = new WxMsgModel(); | |||
| wxMsgModel.setTenantId("1"); | |||
| wxMsgModel.setTenantId(tenantId); | |||
| wxMsgModel.setStatus(1); | |||
| List<WxMsgModel> list = wxMsgModelMapper.findList(wxMsgModel); | |||
| return new ResultData(list); | |||
| } | |||
| @@ -63,7 +63,6 @@ public class WxMsgServiceImpl implements WxMsgService { | |||
| if (wxMsg.getStatus() == 2) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| wxMsg.setId(idWorker.nextId()); | |||
| wxMsg.setTenantId("1"); | |||
| wxMsg.setCreatetime(new Date()); | |||
| wxMsgMapper.insertSelective(wxMsg); | |||
| return new ResultData(Result.SUCCESS, "已保存到草稿箱"); | |||
| @@ -78,7 +77,6 @@ public class WxMsgServiceImpl implements WxMsgService { | |||
| wxMsg.setStatus(0); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| wxMsg.setId(idWorker.nextId()); | |||
| wxMsg.setTenantId("1"); | |||
| wxMsg.setCreatetime(new Date()); | |||
| wxMsgMapper.insertSelective(wxMsg); | |||
| return new ResultData(Result.SUCCESS, "短信会在预设时间发送"); | |||
| @@ -128,7 +126,7 @@ public class WxMsgServiceImpl implements WxMsgService { | |||
| public ResultData sendmsg(WxMsg wxMsg) { | |||
| //从短信配置中查询密钥 bid 等信息 | |||
| WxMsgConfig wxMsgConfig = new WxMsgConfig(); | |||
| wxMsgConfig.setTenantId("1"); | |||
| wxMsgConfig.setTenantId(wxMsg.getTenantId()); | |||
| List<WxMsgConfig> wxMsgConfigs = wxMsgConfigMapper.findList(wxMsgConfig); | |||
| if (wxMsgConfigs.size() == 0) return new ResultData(Result.SUCCESS, "您还未接入短信运营商,请联系平台管理员"); | |||
| wxMsgConfig = wxMsgConfigs.get(0); | |||
| @@ -187,7 +185,6 @@ public class WxMsgServiceImpl implements WxMsgService { | |||
| if (wxMsg.getId() == null) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| wxMsg.setId(idWorker.nextId()); | |||
| wxMsg.setTenantId("1"); | |||
| wxMsg.setCreatetime(new Date()); | |||
| wxMsgMapper.insertSelective(wxMsg); | |||
| } else { | |||
| @@ -0,0 +1,139 @@ | |||
| package com.simple.service.impl; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.IdWorker; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxMsgConfig; | |||
| import com.simple.domain.po.WxMsgModel; | |||
| import com.simple.domain.po.WxMsgValidationcodeModel; | |||
| import com.simple.mapper.WxMsgConfigMapper; | |||
| import com.simple.mapper.WxMsgValidationcodeModelMapper; | |||
| import com.simple.service.WxMsgValidationcodeModelService; | |||
| import com.simple.utils.AesUtil; | |||
| import com.simple.utils.HMACSHA256; | |||
| import com.simple.utils.HttpUtil; | |||
| import com.simple.utils.RsaUtil; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.*; | |||
| @Service | |||
| public class WxMsgValidationcodeModelServiceImpl implements WxMsgValidationcodeModelService { | |||
| @Autowired | |||
| WxMsgValidationcodeModelMapper wxMsgValidationcodeModelMapper; | |||
| @Autowired | |||
| WxMsgConfigMapper wxMsgConfigMapper; | |||
| @Override | |||
| public PageInfo<WxMsgValidationcodeModel> listAsPage(WxMsgValidationcodeModel record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMsgValidationcodeModelMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public WxMsgValidationcodeModel getById(String id) { | |||
| return wxMsgValidationcodeModelMapper.selectByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public ResultData saveOrUpdate(WxMsgValidationcodeModel wxMsgModel) { | |||
| //从短信配置中查询密钥 bid 等信息 | |||
| WxMsgConfig wxMsgConfig = new WxMsgConfig(); | |||
| wxMsgConfig.setTenantId(wxMsgModel.getTenantId()); | |||
| List<WxMsgConfig> wxMsgConfigs = wxMsgConfigMapper.findList(wxMsgConfig); | |||
| if(wxMsgConfigs.size()==0)return new ResultData(Result.SUCCESS, "您还未接入短信运营商,请联系平台管理员"); | |||
| wxMsgConfig = wxMsgConfigs.get(0); | |||
| String secret = wxMsgConfig.getSecret(); | |||
| String bid = wxMsgConfig.getBid(); | |||
| String signature = wxMsgModel.getSignature(); | |||
| String content = wxMsgModel.getContent(); | |||
| //查看用户最新数据是否存在 | |||
| List<WxMsgValidationcodeModel> wxMsgModels = wxMsgValidationcodeModelMapper.findList(wxMsgModel); | |||
| if (wxMsgModel.getId() == null && wxMsgModels.size() == 1) { | |||
| return new ResultData(Result.SUCCESS, "您添加的短信模板已存在"); | |||
| } | |||
| if (wxMsgModel.getId() != null && wxMsgModels.size() == 1) { | |||
| WxMsgValidationcodeModel wxmsgmodel = wxMsgModels.get(0); | |||
| if(wxmsgmodel.getContent().equals(wxMsgModel.getContent()) && wxmsgmodel.getSignature().equals(wxMsgModel.getSignature())) { | |||
| return new ResultData(Result.SUCCESS, "您添加的短信模板已存在"); | |||
| } | |||
| } | |||
| //请求api数据排序 | |||
| TreeMap<String, String> message = new TreeMap<>(); | |||
| message.put("bid", bid); | |||
| message.put("signature", signature); | |||
| message.put("content", content); | |||
| message.put("notify_url",wxMsgConfig.getModelnotifyurl()); | |||
| message.put("verifysms","1"); | |||
| StringBuilder sb = new StringBuilder(); | |||
| Set<Map.Entry<String, String>> entries = message.entrySet(); | |||
| for (Map.Entry<String, String> entry : entries) { | |||
| sb.append(entry.getKey()).append("=").append(entry.getValue()); | |||
| } | |||
| sb.append("&secret=").append(secret); | |||
| String sign = HMACSHA256.sha256_HMAC(sb.toString(), secret); | |||
| message.put("sign", sign.toUpperCase()); | |||
| String str32 = "198b02e8fd704e96198b02e8fd704e96"; | |||
| String iv = "198b02e8fd704e96"; | |||
| Map<String, String> params = new HashMap<>(); | |||
| params.put("iv", iv); | |||
| params.put("bid", bid); | |||
| try { | |||
| String data = AesUtil.AESEncode(str32, JSONObject.toJSONString(message), iv); | |||
| String sc = RsaUtil.RSAEncode(str32.getBytes(), wxMsgConfig.getPublickey()); | |||
| params.put("data", data); | |||
| params.put("sc", sc); | |||
| } catch (Exception e) { | |||
| e.printStackTrace(); | |||
| } | |||
| String requestUrl = "https://webapp.wiwide.com/apisms/addtemplate"; | |||
| String result = HttpUtil.doPost(requestUrl, params); | |||
| JSONObject jsonObjectResult = JSONObject.parseObject(result); | |||
| String ret = jsonObjectResult.get("ret").toString(); | |||
| if (ret.equals("1") || ret.equals("-6")) { | |||
| if (wxMsgModel.getId() == null) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| wxMsgModel.setId(idWorker.nextId()); | |||
| wxMsgModel.setTenantId(wxMsgModel.getTenantId()); | |||
| String data = jsonObjectResult.get("data").toString(); | |||
| wxMsgModel.setModelId(Integer.valueOf(data)); | |||
| wxMsgModel.setCreatetime(new Date()); | |||
| wxMsgModel.setStatus(2);//审核中 | |||
| wxMsgValidationcodeModelMapper.insertSelective(wxMsgModel); | |||
| } else { | |||
| wxMsgValidationcodeModelMapper.updateByPrimaryKeySelective(wxMsgModel); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "创建模板成功"); | |||
| }else if (ret == "-4") { | |||
| return new ResultData(Result.SUCCESS, "短信签名或内容错误"); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "创建模板失败"); | |||
| } | |||
| @Override | |||
| public void deleteById(String id) { | |||
| wxMsgValidationcodeModelMapper.deleteByPrimaryKey(id); | |||
| } | |||
| } | |||
| @@ -3,18 +3,23 @@ package com.simple.service.impl; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.ErrorCode; | |||
| import com.simple.common.IdWorker; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxMall; | |||
| import com.simple.domain.po.WxMsg; | |||
| import com.simple.domain.po.WxMsgConfig; | |||
| import com.simple.domain.po.WxMsgValidationcode; | |||
| import com.simple.domain.po.WxMsgValidationcodeModel; | |||
| import com.simple.mapper.WxMallMapper; | |||
| import com.simple.mapper.WxMsgConfigMapper; | |||
| import com.simple.mapper.WxMsgValidationcodeMapper; | |||
| import com.simple.mapper.WxMsgValidationcodeModelMapper; | |||
| import com.simple.service.WxMsgValidationcodeService; | |||
| import com.simple.utils.*; | |||
| import com.simple.utils.AesUtil; | |||
| import com.simple.utils.HMACSHA256; | |||
| import com.simple.utils.HttpUtil; | |||
| import com.simple.utils.RsaUtil; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| @@ -33,6 +38,8 @@ public class WxMsgValidationcodeServiceImpl implements WxMsgValidationcodeServic | |||
| @Autowired | |||
| WxMallMapper wxMallMapper; | |||
| @Autowired | |||
| WxMsgValidationcodeModelMapper wxMsgValidationcodeModelMapper; | |||
| @Override | |||
| public PageInfo<WxMsgValidationcode> listAsPage(WxMsgValidationcode record, Integer pageIndex, Integer pageSize) { | |||
| @@ -70,21 +77,29 @@ public class WxMsgValidationcodeServiceImpl implements WxMsgValidationcodeServic | |||
| Date currentdate = new Date(); | |||
| wxmsgvalidationcodelist = wxmsgvalidationcodelist.stream().filter(validationcode -> | |||
| validationcode.getExpiretime().after(currentdate)).collect(Collectors.toList()); | |||
| if(wxmsgvalidationcodelist.size()>0) return new ResultData(200,"发送成功"); | |||
| if(wxmsgvalidationcodelist.size()>0) return new ResultData(ErrorCode.MSG_REPEAT_SEND.getCode(),ErrorCode.MSG_REPEAT_SEND.getMessage()); | |||
| //2、根据tenantid查询出商场名称作为签名 | |||
| WxMall wxMall = new WxMall(); | |||
| /*WxMall wxMall = new WxMall(); | |||
| wxMall.setTenantId(wxMsgValidationcode.getTenantId()); | |||
| List<WxMall> wxmallist = wxMallMapper.findList(wxMall); | |||
| wxMsgValidationcode.setSignature(wxmallist.get(0).getName()); | |||
| List<WxMall> wxmallist = wxMallMapper.findList(wxMall);*/ | |||
| //3、从短信配置中查询密钥 bid 等信息 | |||
| WxMsgConfig wxMsgConfig = new WxMsgConfig(); | |||
| wxMsgConfig.setTenantId(wxMsgValidationcode.getTenantId()); | |||
| wxMsgConfig.setAppid(wxMsgValidationcode.getAppid()); | |||
| List<WxMsgConfig> wxMsgConfigs = wxMsgConfigMapper.findList(wxMsgConfig); | |||
| if (wxMsgConfigs.size() == 0) new ResultData(500,"发送失败"); | |||
| wxMsgConfig = wxMsgConfigs.get(0); | |||
| WxMsgValidationcodeModel wxMsgValidationcodeModel = new WxMsgValidationcodeModel(); | |||
| wxMsgValidationcodeModel.setTenantId(wxMsgConfig.getTenantId()); | |||
| wxMsgValidationcodeModel.setType(1); | |||
| wxMsgValidationcodeModel = wxMsgValidationcodeModelMapper.findList(wxMsgValidationcodeModel).get(0); | |||
| wxMsgValidationcode.setSignature(wxMsgValidationcodeModel.getSignature()); | |||
| String secret = wxMsgConfig.getSecret(); | |||
| String bid = wxMsgConfig.getBid(); | |||
| String publickey = wxMsgConfig.getPublickey(); | |||
| @@ -93,7 +108,7 @@ public class WxMsgValidationcodeServiceImpl implements WxMsgValidationcodeServic | |||
| String phone = wxMsgValidationcode.getPhone(); | |||
| String signature = wxMsgValidationcode.getSignature(); | |||
| //内容 | |||
| String msg=new StringBuilder().append(code).append("(动态验证码),请在15分钟内填写").toString(); | |||
| String msg = wxMsgValidationcodeModel.getContent().replace("{s6}", String.valueOf(code)); | |||
| wxMsgValidationcode.setCode(String.valueOf(code)); | |||
| wxMsgValidationcode.setMsg(msg); | |||
| @@ -104,6 +119,7 @@ public class WxMsgValidationcodeServiceImpl implements WxMsgValidationcodeServic | |||
| message.put("signature", signature); | |||
| message.put("msg", msg); | |||
| message.put("notify_url", notifyUrl); | |||
| message.put("verifysms","1"); | |||
| StringBuilder sb = new StringBuilder(); | |||
| Set<Map.Entry<String, String>> entries = message.entrySet(); | |||
| @@ -140,7 +156,8 @@ public class WxMsgValidationcodeServiceImpl implements WxMsgValidationcodeServic | |||
| wxMsgValidationcode.setId(idWorker.nextId()); | |||
| long currentTime = System.currentTimeMillis() ; | |||
| Date createtime=new Date(currentTime); | |||
| currentTime +=15*60*1000; | |||
| Integer minutes = wxMsgValidationcodeModel.getMinutes(); | |||
| currentTime +=minutes*60*1000; | |||
| Date expiredate=new Date(currentTime); | |||
| wxMsgValidationcode.setExpiretime(expiredate); | |||
| wxMsgValidationcode.setCreatetime(createtime); | |||
| @@ -166,8 +166,8 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| record.setCreateDate(curr); | |||
| record.setUpdateDate(curr); | |||
| wxOrderMapper.insertSelective(record); | |||
| } catch (RuntimeException e) { | |||
| // TODO 增库存 | |||
| logger.error("保存订单:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | |||
| } | |||
| @@ -188,6 +188,147 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| wxCouponOrderMapper.insertSelective(couponOrder); | |||
| } catch (RuntimeException e) { | |||
| // TODO 增库存 | |||
| logger.error("WxCouponOrder:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | |||
| } | |||
| return record; | |||
| } | |||
| @Override | |||
| public WxOrder sendUserFreeCoupon(Long userId, Long couponId) { | |||
| WxCUser user = null; | |||
| WxCUser userQ = new WxCUser(); | |||
| userQ.setId(userId); | |||
| try { | |||
| user = wxCUserMapper.selectOne(userQ); | |||
| } catch (Exception e) { | |||
| logger.error("userId : " + userId + ", e: " + e.getMessage()); | |||
| } | |||
| if (user == null) { | |||
| logger.error("用户不存在, userId: " + userId); | |||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY); | |||
| } | |||
| String couponIdStr = String.valueOf(couponId); | |||
| WxCoupon coupon = wxCouponMapper.selectByPrimaryKey(couponId); | |||
| if (coupon == null) { | |||
| logger.error("券不存在, couponId: " + couponIdStr); | |||
| throw new MallinkException(ErrorCode.COUPON_IS_EMPTY); | |||
| } | |||
| if (coupon.getSalePrice() != 0) { | |||
| logger.error("券不免费, couponId: " + couponIdStr); | |||
| throw new MallinkException(ErrorCode.COUPON_IS_NOT_FREE); | |||
| } | |||
| //加锁 | |||
| long time = System.currentTimeMillis() + RedisLock.TIMEOUT; | |||
| String timeStr = String.valueOf(time); | |||
| if(!redisLock.lock(couponIdStr, timeStr)) { | |||
| logger.error("此券被锁定, couponId: " + couponIdStr); | |||
| throw new MallinkException(ErrorCode.TOO_MANY_REQUEST); | |||
| } | |||
| int payPrice = 0; | |||
| int payment = 0; | |||
| Date curr = new Date(); | |||
| Date valid_date = null; | |||
| // 检查 优惠券 库存 | |||
| if (coupon.getRemainInventory() <= 0) { | |||
| //解锁 | |||
| redisLock.unlock(couponIdStr, timeStr); | |||
| logger.error("此券库存为0, couponId: " + couponIdStr); | |||
| throw new MallinkException(ErrorCode.REMAIN_IS_EMPTY); | |||
| } | |||
| // check 购买是否超限 | |||
| int count = 0; | |||
| try { | |||
| WxCouponOrder query = new WxCouponOrder(); | |||
| query.setCouponId(couponId); | |||
| query.setCUserId(user.getId()); | |||
| query.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()); | |||
| count = wxCouponOrderMapper.selectCount(query); | |||
| }catch (Exception e) { | |||
| //解锁 | |||
| redisLock.unlock(couponIdStr, timeStr); | |||
| logger.error("购买是否超限-DB, couponId: " + couponIdStr + ", e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | |||
| } | |||
| if (count > coupon.getUseLimitQuantity()) { | |||
| //解锁 | |||
| redisLock.unlock(couponIdStr, timeStr); | |||
| logger.error("此券购买数量已超限, couponId: " + couponIdStr + ", count: " + count); | |||
| throw new MallinkException(ErrorCode.ORDER_IS_LIMITED); | |||
| } | |||
| try { | |||
| // 减库存 | |||
| coupon.setRemainInventory(coupon.getRemainInventory() - 1); | |||
| wxCouponMapper.updateByPrimaryKeySelective(coupon); | |||
| //解锁 | |||
| redisLock.unlock(couponIdStr, timeStr); | |||
| } catch (RuntimeException e) { | |||
| //解锁 | |||
| redisLock.unlock(couponIdStr, timeStr); | |||
| logger.error("此券减库存失败, couponId: " + couponIdStr); | |||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | |||
| } | |||
| payPrice = coupon.getSalePrice(); | |||
| payment = coupon.getSalePrice(); | |||
| valid_date = (coupon.getValidType() == EnumValidStatus.VALID_RANGE.getCode())? | |||
| coupon.getValidEndDate(): | |||
| new Date((curr.getTime()/1000+coupon.getValidDays()*24*60*60)*1000); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| Long orderNumber = idWorker.nextId(); | |||
| // body | |||
| // tenant_id + merchant_id + title + subtitle | |||
| String bodyStr = coupon.getTitle() + "/" + coupon.getSubTitle(); | |||
| WxOrder record = new WxOrder(); | |||
| try { | |||
| // 保存订单 | |||
| record.setId(orderNumber); | |||
| record.setTenantId(user.getTenantId()); | |||
| record.setOrderNumber(orderNumber); | |||
| record.setCUserId(user.getId()); | |||
| record.setMerchantId(coupon.getMerchantId()); | |||
| record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); | |||
| record.setPayment(payment); | |||
| record.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode()); | |||
| record.setDetail(bodyStr); | |||
| record.setCreateDate(curr); | |||
| record.setUpdateDate(curr); | |||
| wxOrderMapper.insertSelective(record); | |||
| } catch (RuntimeException e) { | |||
| // TODO 增库存 | |||
| logger.error("保存订单:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | |||
| } | |||
| try { | |||
| WxCouponOrder couponOrder = new WxCouponOrder(); | |||
| couponOrder.setId(idWorker.nextId()); | |||
| couponOrder.setTenantId(user.getTenantId()); | |||
| couponOrder.setCouponId(couponId); | |||
| couponOrder.setCUserId(user.getId()); | |||
| couponOrder.setOrderId(orderNumber); | |||
| couponOrder.setExpiredTime(valid_date); | |||
| couponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()); | |||
| couponOrder.setCreateDate(curr); | |||
| couponOrder.setUpdateDate(curr); | |||
| couponOrder.setCouponPrice(payPrice); | |||
| wxCouponOrderMapper.insertSelective(couponOrder); | |||
| } catch (RuntimeException e) { | |||
| // TODO 增库存 | |||
| logger.error("WxCouponOrder:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | |||
| } | |||
| @@ -13,6 +13,7 @@ import com.simple.common.ResultData; | |||
| import com.simple.domain.po.*; | |||
| import com.simple.enums.EnumOrderStatus; | |||
| import com.simple.enums.EnumPayStatus; | |||
| import com.simple.enums.EnumPayType; | |||
| import com.simple.enums.EnumPayWay; | |||
| import com.simple.exception.MallinkException; | |||
| import com.simple.mapper.WxAppinfoMapper; | |||
| @@ -86,6 +87,9 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| logger.error("pay order, order status not allow, repaymentReq: " + order.toString() + " , payWay: " + payWay.toString()); | |||
| throw new MallinkException(ErrorCode.ORDER_IS_NOT_PAY); | |||
| } | |||
| if (order.getPaymentType() != EnumPayType.PAY_PAYMENT.getCode()) { | |||
| return new ResultData(ErrorCode.PAY_ORDER_IS_NOT_PAYMENT); | |||
| } | |||
| // 2. check 是否有支付订单 | |||
| Date currentDate = new Date(); | |||
| List<WxPayOrder> list = wxPayOrderMapper.findList(record); | |||
| @@ -216,10 +220,10 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| } | |||
| if (!"SUCCESS".equals(paramMap.get("return_code"))) { | |||
| logger.warn("notify order, wxpay status not success, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); | |||
| Map<String, String> resultMap = new LinkedHashMap<>(); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", "订单状态码非SUCCESS"); | |||
| return XmlUtil.parseDto2Xml(resultMap, ""); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } | |||
| String payOrderNo = paramMap.get("out_trade_no"); | |||
| @@ -228,18 +232,18 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| WxPayOrder payOrder = wxPayOrderMapper.selectByPrimaryKey(payOrderId); | |||
| if (payOrder == null) { | |||
| logger.warn("notify order, wxpay check pay order not exists, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); | |||
| Map<String, String> resultMap = new LinkedHashMap<>(); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", "订单不存在"); | |||
| return XmlUtil.parseDto2Xml(resultMap, ""); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } | |||
| // 验证支付金额 | |||
| if (!paramMap.get("total_fee").equals(payOrder.getPayAmount().toString())) { | |||
| logger.warn("notify order, wxpay check total_fee is invalid, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); | |||
| Map<String, String> resultMap = new LinkedHashMap<>(); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", "订单总金额不一致"); | |||
| return XmlUtil.parseDto2Xml(resultMap, ""); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } | |||
| Date timeEnd = null; | |||
| @@ -255,16 +259,19 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| // 处理支付成功 | |||
| handleOrderPaySuccess(payOrder, paramMap.get("transaction_id")); | |||
| logger.info("notify order, wxpay checksign success, paramMap:{}, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); | |||
| Map<String, String> resultMap = new LinkedHashMap<>(); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "SUCCESS"); | |||
| resultMap.put("return_msg", "OK"); | |||
| return XmlUtil.parseDto2Xml(resultMap, ""); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } | |||
| } catch (RuntimeException e) { | |||
| logger.warn("notify order, alipay checksign error, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString() + ", e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.PAY_ORDER_NOTIFY_CHECK_SIGN_ERROR); | |||
| throw new MallinkException(ErrorCode.PAY_ORDER_ERROR); | |||
| } | |||
| return ""; | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", "FAILED"); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } | |||
| @Override | |||
| @@ -355,32 +362,41 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| } | |||
| Date currentDate = new Date(); | |||
| // 修改支付订单状态 | |||
| try { | |||
| WxPayOrder updateOrder = new WxPayOrder(); | |||
| updateOrder.setId(record.getId()); | |||
| updateOrder.setOrderId(record.getOrderId()); | |||
| updateOrder.setUpdateTime(currentDate); | |||
| updateOrder.setPayOrderStatus(record.getPayOrderStatus()); | |||
| updateOrder.setPayTimeEnd(currentDate); | |||
| updateOrder.setFailReason(record.getFailReason()); | |||
| wxPayOrderMapper.updateByPrimaryKeySelective(updateOrder); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL); | |||
| if (record.getId() > 0) { | |||
| // 修改支付订单状态 | |||
| // 订单金额为0时,支付订单不创建,直接更改订单状态 | |||
| try { | |||
| WxPayOrder updateOrder = new WxPayOrder(); | |||
| updateOrder.setId(record.getId()); | |||
| updateOrder.setOrderId(record.getOrderId()); | |||
| updateOrder.setUpdateTime(currentDate); | |||
| updateOrder.setPayOrderStatus(record.getPayOrderStatus()); | |||
| updateOrder.setPayTimeEnd(currentDate); | |||
| updateOrder.setFailReason(record.getFailReason()); | |||
| wxPayOrderMapper.updateByPrimaryKeySelective(updateOrder); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL); | |||
| } | |||
| } | |||
| // 修改订单状态 | |||
| if (record.getPayOrderStatus() == EnumPayStatus.PAY_WAY_SUCCESS.getCode()) { | |||
| try { | |||
| wxOrderService.updateOrderStatus(order.getId(), EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS); | |||
| int _count = wxOrderService.updateOrderStatus(order.getId(), EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS); | |||
| if (_count > 1) { | |||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | |||
| } | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL); | |||
| } | |||
| } else if (record.getPayOrderStatus() == EnumPayStatus.PAY_WAY_CANCEL.getCode()) { | |||
| try { | |||
| wxOrderService.updateOrderStatus(order.getId(), EnumOrderStatus.ORDER_STATUS_OVERTIME_CANCEL); | |||
| int _count = wxOrderService.updateOrderStatus(order.getId(), EnumOrderStatus.ORDER_STATUS_OVERTIME_CANCEL); | |||
| if (_count > 1) { | |||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | |||
| } | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL); | |||
| @@ -18,6 +18,7 @@ import com.simple.mapper.*; | |||
| import com.simple.pay.WxPayment; | |||
| import com.simple.pay.WxProfitSharing; | |||
| import com.simple.pay.WxProfitSharingP; | |||
| import com.simple.pay.WxProfitSharingQueryP; | |||
| import com.simple.service.WxProfitSharingOrderService; | |||
| import com.simple.utils.BeanUtils; | |||
| import com.simple.utils.Utility; | |||
| @@ -48,20 +49,43 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| @Autowired | |||
| WxProfitSharingResultMapper wxProfitSharingResultMapper; | |||
| final JSONObject errorMap = JSON.parseObject( | |||
| "{\"SYSTEMERROR\":{\"detail\":\"接口返回错误\",\"reason\":\"系统超时\",\"resolution\":\"系统异常,请用相同参数重新调用\"}," + | |||
| "\"AMOUNT_OVERDUE\":{\"detail\":\"分账金额超限\",\"reason\":\"分账金额大于可分金额 或大于分账最大比例 \",\"resolution\":\"请调整分账金额\"}," + | |||
| "\"RECEIVER_INVALID\":{\"detail\":\"分账接收方非法 \",\"reason\":\"未配置分账接收方\",\"resolution\":\"分账接收方在分账之前需要进行添加\"}," + | |||
| "\"INVALID_TRANSACTIONID\":{\"detail\":\"无效的微信支付订单号\",\"reason\":\"请求参数未按指引进行填写\",\"resolution\":\"检查原交易单号是否存在\"}," + | |||
| "\"PARAM_ERROR\":{\"detail\":\"参数错误\t\",\"reason\":\"请求参数未按指引进行填写\",\"resolution\":\"请求参数错误,请重新检查再调用分账接口\"}," + | |||
| "\"INVALID_REQUEST\":{\"detail\":\"请求不合法\",\"reason\":\"参数中APPID或MCHID不存在等 \",\"resolution\":\"请重新检查再调用分账接口\"}," + | |||
| "\"OPENID_MISMATCH\":{\"detail\":\"Openid错误\",\"reason\":\"Openid与Appid不匹配\",\"resolution\":\"请检查openid是否正确\"}," + | |||
| "\"FREQUENCY_LIMITED\":{\"detail\":\"频率限制\",\"reason\":\"请求过多被频率限制\",\"resolution\":\"该被请求未受理,请降低频率后原单重试,请勿更换商户分账单号\"}," + | |||
| "\"ORDER_NOT_READY\":{\"detail\":\"订单处理中\",\"reason\":\"订单处理中暂时无法分账\",\"resolution\":\"订单处理中暂时无法分账,请稍后再试\"}," + | |||
| "\"NOAUTH \":{\"detail\":\"无分账权限\",\"reason\":\"未开通分账权限\",\"resolution\":\"请先开通分账权限\"}," + | |||
| "\"NOT_SHARE_ORDER\":{\"detail\":\"非分账订单\t\",\"reason\":\"不是分账订单,无法分账\",\"resolution\":\"下单时请用合适的参数\"}}"); | |||
| @Autowired | |||
| WxCUserMapper wxCUserMapper; | |||
| final JSONObject errorMap = JSON.parseObject("{" + | |||
| "\"SYSTEMERROR\":{\"detail\":\"接口返回错误\",\"reason\":\"系统超时\",\"resolution\":\"系统异常,请用相同参数重新调用\"}," + | |||
| "\"AMOUNT_OVERDUE\":{\"detail\":\"分账金额超限\",\"reason\":\"分账金额大于可分金额 或大于分账最大比例 \",\"resolution\":\"请调整分账金额\"}," + | |||
| "\"RECEIVER_INVALID\":{\"detail\":\"分账接收方非法 \",\"reason\":\"未配置分账接收方\",\"resolution\":\"分账接收方在分账之前需要进行添加\"}," + | |||
| "\"INVALID_TRANSACTIONID\":{\"detail\":\"无效的微信支付订单号\",\"reason\":\"请求参数未按指引进行填写\",\"resolution\":\"检查原交易单号是否存在\"}," + | |||
| "\"PARAM_ERROR\":{\"detail\":\"参数错误\\t\",\"reason\":\"请求参数未按指引进行填写\",\"resolution\":\"请求参数错误,请重新检查再调用分账接口\"}," + | |||
| "\"INVALID_REQUEST\":{\"detail\":\"请求不合法\",\"reason\":\"参数中APPID或MCHID不存在等 \",\"resolution\":\"请重新检查再调用分账接口\"}," + | |||
| "\"OPENID_MISMATCH\":{\"detail\":\"Openid错误\",\"reason\":\"Openid与Appid不匹配\",\"resolution\":\"请检查openid是否正确\"}," + | |||
| "\"FREQUENCY_LIMITED\":{\"detail\":\"频率限制\",\"reason\":\"请求过多被频率限制\",\"resolution\":\"该被请求未受理,请降低频率后原单重试,请勿更换商户分账单号\"}," + | |||
| "\"ORDER_NOT_READY\":{\"detail\":\"订单处理中\",\"reason\":\"订单处理中暂时无法分账\",\"resolution\":\"订单处理中暂时无法分账,请稍后再试\"}," + | |||
| "\"NOAUTH \":{\"detail\":\"无分账权限\",\"reason\":\"未开通分账权限\",\"resolution\":\"请先开通分账权限\"}," + | |||
| "\"NOT_SHARE_ORDER\":{\"detail\":\"非分账订单\\t\",\"reason\":\"不是分账订单,无法分账\",\"resolution\":\"下单时请用合适的参数\"}}"); | |||
| final JSONObject errorMapQuery = JSON.parseObject("{" + | |||
| "\"SYSTEMERROR\":{\"detail\":\"接口返回错误\",\"reason\":\"系统超时\",\"resolution\":\"系统异常,请用相同参数重新调用\"}," + | |||
| "\"INVALID_TRANSACTIONID\":{\"detail\":\"无效的微信支付订单号\",\"reason\":\"请求参数未按指引进行填写\",\"resolution\":\"检查原交易单号是否存在\"}," + | |||
| "\"PARAM_ERROR\":{\"detail\":\"参数错误\\t\",\"reason\":\"请求参数未按指引进行填写\",\"resolution\":\"请求参数错误,请重新检查再调用分账接口\"}," + | |||
| "\"INVALID_REQUEST\":{\"detail\":\"请求不合法\",\"reason\":\"参数中APPID或MCHID不存在等 \",\"resolution\":\"请重新检查再调用分账接口\"}," + | |||
| "\"ORDERNOTEXIST\":{\"detail\":\"分账单不存在\",\"reason\":\"订单号错误或分账单号错误\",\"resolution\":\"请检查订单号或分账单号是否有错误\"}}"); | |||
| final JSONObject statusMap = JSON.parseObject( | |||
| "{\"ACCEPTED\":3," + | |||
| "\"PROCESSING\": 4," + | |||
| "\"FINISHED\": 5," + | |||
| "\"CLOSED\": 6}"); | |||
| final JSONObject resultStatusMap = JSON.parseObject( | |||
| "{\"PENDING\": 1," + | |||
| "\"SUCCESS\": 2," + | |||
| "\"ADJUST\": 3," + | |||
| "\"RETURNED\": 4," + | |||
| "\"CLOSED\": 5}"); | |||
| @Override | |||
| public PageInfo<WxProfitSharingOrder> listAsPage(WxProfitSharingOrder record, Integer pageIndex, Integer pageSize) { | |||
| @@ -95,17 +119,37 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| @Override | |||
| public void test() { | |||
| createSharingOrder(wxAppinfoMapper.selectByPrimaryKey(new Long(1L)),wxPayOrderMapper.selectByPrimaryKey(new Long(190403470006681600L))); | |||
| createSharingOrder(wxPayOrderMapper.selectByPrimaryKey(new Long(190403470006681600L))); | |||
| } | |||
| private WxAppinfo getAppinfo(WxPayOrder wxPayOrder) { | |||
| WxAppinfo wxAppinfo; | |||
| WxCUser wxCUser = wxCUserMapper.selectByPrimaryKey(wxPayOrder.getCUserId()); | |||
| if (wxCUser == null) | |||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), ErrorCode.USER_IS_EMPTY.getMessage()); | |||
| wxAppinfo = wxAppinfoMapper.selectByPrimaryKey(wxCUser.getAppId()); | |||
| if (wxAppinfo == null) | |||
| throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND.getCode(), ErrorCode.APP_ID_NOT_FOUND.getMessage()); | |||
| return wxAppinfo; | |||
| } | |||
| @Override | |||
| public ResultData createSharingOrder(WxAppinfo subAppInfo, WxPayOrder wxPayOrder) { | |||
| public ResultData createSharingOrder(WxPayOrder wxPayOrder) { | |||
| final IdWorker idworker = IdWorker.get(); | |||
| WxProfitSharingOrder record = new WxProfitSharingOrder(); | |||
| try { | |||
| WxAppinfo subAppInfo = getAppinfo(wxPayOrder); | |||
| WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(subAppInfo.getPayId()); | |||
| //WxPayAccount mainPayAccount = wxPayAccountMapper.selectByPrimaryKey(new Long(EnumPayDomain.PAY_DOMAIN_MASTER_ACCOUNT_ID.getCode())); | |||
| //WxAppinfo mainAppInfo = wxAppinfoMapper.selectByPrimaryKey(new Long(EnumPayDomain.PAY_DOMAIN_MASTER_APPINFO_ID.getCode())); | |||
| WxOrder wxOrder = wxOrderMapper.selectByPrimaryKey(wxPayOrder.getOrderId()); | |||
| //是否已创建分账订单 | |||
| WxProfitSharingOrder record = new WxProfitSharingOrder(); | |||
| record.setOrderId(wxPayOrder.getId().toString()); | |||
| record = wxProfitSharingOrderMapper.selectOne(record); | |||
| if (record == null) { | |||
| @@ -126,10 +170,6 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| wxProfitSharingOrderMapper.insertSelective(record); | |||
| } | |||
| WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(subAppInfo.getPayId()); | |||
| //WxPayAccount mainPayAccount = wxPayAccountMapper.selectByPrimaryKey(new Long(EnumPayDomain.PAY_DOMAIN_MASTER_ACCOUNT_ID.getCode())); | |||
| //WxAppinfo mainAppInfo = wxAppinfoMapper.selectByPrimaryKey(new Long(EnumPayDomain.PAY_DOMAIN_MASTER_APPINFO_ID.getCode())); | |||
| //分账提交 | |||
| WxProfitSharingP wxProfitSharingP = new WxProfitSharingP(); | |||
| //wxProfitSharingP.setAppid(mainAppInfo.getAppId()); | |||
| @@ -211,4 +251,98 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); | |||
| } | |||
| } | |||
| @Override | |||
| public ResultData querySharingOrder(WxPayOrder wxPayOrder) { | |||
| WxProfitSharingOrder record = new WxProfitSharingOrder(); | |||
| try { | |||
| WxAppinfo subAppInfo = getAppinfo(wxPayOrder); | |||
| WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(subAppInfo.getPayId()); | |||
| //WxPayAccount mainPayAccount = wxPayAccountMapper.selectByPrimaryKey(new Long(EnumPayDomain.PAY_DOMAIN_MASTER_ACCOUNT_ID.getCode())); | |||
| WxOrder wxOrder = wxOrderMapper.selectByPrimaryKey(wxPayOrder.getOrderId()); | |||
| //是否已创建分账订单 | |||
| record.setOrderId(wxPayOrder.getId().toString()); | |||
| record = wxProfitSharingOrderMapper.selectOne(record); | |||
| if (record == null) | |||
| throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND.getCode(), ErrorCode.ORDER_IS_NOT_FIND.getMessage()); | |||
| //分账提交 | |||
| WxProfitSharingQueryP wxProfitSharingQueryP = new WxProfitSharingQueryP(); | |||
| //wxProfitSharingP.setMch_id(mainPayAccount.getMchId()); | |||
| wxProfitSharingQueryP.setMch_id(payAccount.getMchId()); | |||
| wxProfitSharingQueryP.setSub_mch_id(payAccount.getMchId()); | |||
| wxProfitSharingQueryP.setNonce_str(Utility.generate32UUID()); | |||
| wxProfitSharingQueryP.setTransaction_id(wxPayOrder.getTransactionId()); | |||
| wxProfitSharingQueryP.setOut_trade_no(record.getId().toString()); | |||
| wxProfitSharingQueryP.setSign(WxPayment.createSign(BeanUtils.toStringMap(wxProfitSharingQueryP), payAccount.getApiKey())); | |||
| String response = WxProfitSharing.pushOrder(BeanUtils.toStringMap(wxProfitSharingQueryP)); | |||
| Map<String, String> returnMap = WxPayment.xmlToMap(response); | |||
| String return_code = returnMap.get("return_code"); | |||
| if (!"SUCCESS".equals(return_code)) { | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_QUERY_REQUEST_FAILED.getCode(), returnMap.get("return_msg")); | |||
| } | |||
| if (!WxPayment.verifyNotify(returnMap,payAccount.getApiKey())){ | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_QUERY_RETURN_INVALID.getCode(), ErrorCode.PROFIT_SHARING_RETURN_INVALID.getMessage()); | |||
| } | |||
| String out_order_no = returnMap.get("out_order_no"); | |||
| if (!out_order_no.equals(record.getId().toString())){ | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_QUERY_RETURN_INVALID.getCode(), ErrorCode.PROFIT_SHARING_RETURN_INVALID.getMessage()); | |||
| } | |||
| String result_code = returnMap.get("result_code"); | |||
| if (!"SUCCESS".equals(result_code)) { | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_QUERY_APPLY_FAILED.getCode(), returnMap.get("result_msg")); | |||
| } | |||
| record.setSharingStatus((Integer) statusMap.get(returnMap.get("status"))); | |||
| record.setUpdateTime(new Date()); | |||
| wxProfitSharingOrderMapper.updateByPrimaryKey(record); | |||
| String receivers = returnMap.get("receivers"); | |||
| JSONArray jReceivers = JSONArray.parseArray(receivers); | |||
| WxProfitSharingResult result = new WxProfitSharingResult(); | |||
| result.setSharingOrderId(record.getId().toString()); | |||
| List <WxProfitSharingResult> wxProfitSharingResultList = wxProfitSharingResultMapper.findList(result); | |||
| WxProfitSharingReceiver wxProfitSharingReceiver; | |||
| WxProfitSharingResult wxProfitSharingResult; | |||
| for(int i=0; i<wxProfitSharingResultList.size();i++) { | |||
| wxProfitSharingResult = wxProfitSharingResultList.get(i); | |||
| wxProfitSharingReceiver = wxProfitSharingReceiverMapper | |||
| .selectByPrimaryKey(wxProfitSharingResult.getSharingReceiverId()); | |||
| for(int j=0; j<jReceivers.size();j++) { | |||
| JSONObject res = (JSONObject)jReceivers.get(j); | |||
| if (res.getString("type").equals(wxProfitSharingReceiver.getReceiverType()) | |||
| && res.getString("account").equals(wxProfitSharingReceiver.getReceiverAccount())) { | |||
| wxProfitSharingResult.setFinishTime(res.getString("finish_time")); | |||
| wxProfitSharingResult.setUpdateTime(new Date()); | |||
| wxProfitSharingResult.setSharingStatus(resultStatusMap.getIntValue(res.getString("result"))); | |||
| wxProfitSharingResult.setFailedReason(res.getString("fail_reason")); | |||
| wxProfitSharingResultMapper.updateByPrimaryKey(wxProfitSharingResult); | |||
| } | |||
| } | |||
| } | |||
| return new ResultData(returnMap); | |||
| } catch (RuntimeException e) { | |||
| throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); | |||
| } catch (Exception e) { | |||
| throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); | |||
| } | |||
| } | |||
| } | |||
| @@ -257,6 +257,8 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| throw new MallinkException(ErrorCode.REFUND_PAY_ORDER_IS_ZERO); | |||
| } | |||
| // TODO 检查 是否已核销, 已核销不能退款 | |||
| // 创建退款订单 | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| Long id = idWorker.nextId(); | |||
| @@ -396,10 +398,10 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| } | |||
| if (!"SUCCESS".equals(paramMap.get("return_code"))) { | |||
| logger.warn("notify order, wxpay status not success, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); | |||
| Map<String, String> resultMap = new LinkedHashMap<>(); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", "订单状态码非SUCCESS"); | |||
| return XmlUtil.parseDto2Xml(resultMap, ""); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } | |||
| String payOrderNo = paramMap.get("out_trade_no"); | |||
| @@ -407,59 +409,62 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| WxPayOrder payOrder = wxPayOrderMapper.selectByPrimaryKey(payOrderId); | |||
| if (payOrder == null) { | |||
| logger.warn("notify order, wxpay check pay order not exists, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); | |||
| Map<String, String> resultMap = new LinkedHashMap<>(); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", "订单不存在"); | |||
| return XmlUtil.parseDto2Xml(resultMap, ""); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } | |||
| // 验证支付金额 | |||
| if(!paramMap.get("total_fee").equals(payOrder.getPayAmount().toString())) { | |||
| logger.warn("notify order, wxpay check total_fee is invalid, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); | |||
| Map<String, String> resultMap = new LinkedHashMap<>(); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", "订单总金额不一致"); | |||
| return XmlUtil.parseDto2Xml(resultMap, ""); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } | |||
| String refundOrderNo = paramMap.get("out_refund_no"); | |||
| Long refundOrderId = Long.valueOf(refundOrderNo); | |||
| WxRefundOrder refundOrder = wxRefundOrderMapper.selectByPrimaryKey(refundOrderId); | |||
| if (refundOrder == null) { | |||
| logger.warn("notify order, wxpay check pay order not exists, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); | |||
| Map<String, String> resultMap = new LinkedHashMap<>(); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", "退款订单不存在"); | |||
| return XmlUtil.parseDto2Xml(resultMap, ""); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } | |||
| // 验证支付金额 | |||
| if(!paramMap.get("total_fee").equals(refundOrder.getTotalFee().toString())) { | |||
| logger.warn("notify order, wxpay check total_fee is invalid, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); | |||
| Map<String, String> resultMap = new LinkedHashMap<>(); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", "订单总金额不一致"); | |||
| return XmlUtil.parseDto2Xml(resultMap, ""); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } | |||
| // 验证退款金额 | |||
| if(!paramMap.get("refund_fee").equals(refundOrder.getRefundFee().toString())) { | |||
| logger.warn("notify order, wxpay check refund_fee is invalid, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); | |||
| Map<String, String> resultMap = new LinkedHashMap<>(); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", "退款总金额不一致"); | |||
| return XmlUtil.parseDto2Xml(resultMap, ""); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } | |||
| // 处理支付成功 | |||
| handleRefundSuccess(refundOrder, paramMap.get("transaction_id"), paramMap.get("refund_id")); | |||
| logger.info("notify order, wxpay checksign success, paramMap:{}, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); | |||
| Map<String, String> resultMap = new LinkedHashMap<>(); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "SUCCESS"); | |||
| resultMap.put("return_msg", "OK"); | |||
| return XmlUtil.parseDto2Xml(resultMap, ""); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } | |||
| } catch (RuntimeException e) { | |||
| logger.warn("notify order, alipay checksign error, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString() + ", e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.PAY_ORDER_NOTIFY_CHECK_SIGN_ERROR); | |||
| throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR); | |||
| } | |||
| return ""; | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", "FAILED"); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } | |||
| @Override | |||
| @@ -5,6 +5,14 @@ import org.apache.commons.logging.LogFactory; | |||
| import org.dom4j.*; | |||
| import org.dom4j.tree.DefaultElement; | |||
| import javax.xml.parsers.DocumentBuilder; | |||
| import javax.xml.parsers.DocumentBuilderFactory; | |||
| 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.StringWriter; | |||
| import java.util.*; | |||
| /** | |||
| @@ -385,4 +393,67 @@ public final class XmlUtil { | |||
| return map; | |||
| } | |||
| /** | |||
| * 将Map转换为XML格式的字符串 | |||
| * | |||
| * @param data Map类型数据 | |||
| * @return XML格式的字符串 | |||
| * @throws Exception | |||
| */ | |||
| public static String mapToXml(Map<String, String> data) throws Exception { | |||
| DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); | |||
| DocumentBuilder documentBuilder= documentBuilderFactory.newDocumentBuilder(); | |||
| org.w3c.dom.Document document = documentBuilder.newDocument(); | |||
| org.w3c.dom.Element root = document.createElement("xml"); | |||
| document.appendChild(root); | |||
| for (String key: data.keySet()) { | |||
| String value = data.get(key); | |||
| if (value == null) { | |||
| value = ""; | |||
| } | |||
| value = value.trim(); | |||
| org.w3c.dom.Element filed = document.createElement(key); | |||
| filed.appendChild(document.createTextNode(value)); | |||
| root.appendChild(filed); | |||
| } | |||
| TransformerFactory tf = TransformerFactory.newInstance(); | |||
| Transformer transformer = tf.newTransformer(); | |||
| DOMSource source = new DOMSource(document); | |||
| transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); | |||
| transformer.setOutputProperty(OutputKeys.INDENT, "yes"); | |||
| StringWriter writer = new StringWriter(); | |||
| StreamResult result = new StreamResult(writer); | |||
| transformer.transform(source, result); | |||
| String output = writer.getBuffer().toString(); //.replaceAll("\n|\r", ""); | |||
| try { | |||
| writer.close(); | |||
| } | |||
| catch (Exception ex) { | |||
| } | |||
| return output; | |||
| } | |||
| /* | |||
| * 将SortedMap<Object,Object> 集合转化成 xml格式 | |||
| */ | |||
| public static String getRequestXml(SortedMap<Object,Object> parameters){ | |||
| StringBuffer sb = new StringBuffer(); | |||
| sb.append("<xml>"); | |||
| Set es = parameters.entrySet(); | |||
| Iterator it = es.iterator(); | |||
| while(it.hasNext()) { | |||
| Map.Entry entry = (Map.Entry)it.next(); | |||
| String k = (String)entry.getKey(); | |||
| String v = (String)entry.getValue(); | |||
| if ("attach".equalsIgnoreCase(k)||"body".equalsIgnoreCase(k)||"sign".equalsIgnoreCase(k)|| | |||
| "return_code".equalsIgnoreCase(k)||"return_msg".equalsIgnoreCase(k)) { | |||
| sb.append("<"+k+">"+"<![CDATA["+v+"]]></"+k+">"); | |||
| }else { | |||
| sb.append("<"+k+">"+v+"</"+k+">"); | |||
| } | |||
| } | |||
| sb.append("</xml>"); | |||
| return sb.toString(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,121 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.simple.mapper.CouponInjectMapper"> | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.CouponInject"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="name" jdbcType="VARCHAR" property="name" /> | |||
| <result column="m_user_id" jdbcType="BIGINT" property="mUserId" /> | |||
| <result column="send_type" jdbcType="INTEGER" property="sendType" /> | |||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId" /> | |||
| <result column="coupon_name" jdbcType="VARCHAR" property="couponName" /> | |||
| <result column="send_time" jdbcType="TIMESTAMP" property="sendTime" /> | |||
| <result column="send_amount" jdbcType="INTEGER" property="sendAmount" /> | |||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||
| <result column="error_msg" jdbcType="VARCHAR" property="errorMsg" /> | |||
| <result column="tags" jdbcType="VARCHAR" property="tags" /> | |||
| <result column="model_id" jdbcType="BIGINT" property="modelId" /> | |||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`name`,`m_user_id`,`send_type`,`coupon_id`,`coupon_name`,`send_time`,`send_amount`,`status`,`error_msg`,`tags`,`model_id`,`create_time`,`update_time` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||
| </if> | |||
| <if test=" null != name "> | |||
| and `name` like concat('%', #{name},'%') | |||
| </if> | |||
| <if test=" null != mUserId "> | |||
| and `m_user_id` like concat('%', #{mUserId},'%') | |||
| </if> | |||
| <if test=" null != sendType "> | |||
| and `send_type` = #{sendType} | |||
| </if> | |||
| <if test=" null != couponId "> | |||
| and `coupon_id` = #{couponId} | |||
| </if> | |||
| <if test=" null != couponName "> | |||
| and `coupon_name` like concat('%', #{couponName},'%') | |||
| </if> | |||
| <if test=" null != sendTime "> | |||
| and `send_time` = #{sendTime} | |||
| </if> | |||
| <if test=" null != sendTimeStart and null!=sendTimeEnd "> | |||
| and `send_time` >= #{sendTimeStart} and `send_time` <= #{sendTimeEnd} | |||
| </if> | |||
| <if test=" null != sendAmount "> | |||
| and `send_amount` = #{sendAmount} | |||
| </if> | |||
| <if test=" null != status "> | |||
| and `status` = #{status} | |||
| </if> | |||
| <if test=" null != errorMsg "> | |||
| and `error_msg` like concat('%', #{errorMsg},'%') | |||
| </if> | |||
| <if test=" null != tags "> | |||
| and `tags` like concat('%', #{tags},'%') | |||
| </if> | |||
| <if test=" null != createTime "> | |||
| and `create_time` = #{createTime} | |||
| </if> | |||
| <if test=" null != updateTime "> | |||
| and `update_time` = #{updateTime} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.simple.domain.po.CouponInject" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from coupon_inject | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| </mapper> | |||
| @@ -60,9 +60,12 @@ | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id ="findCountByTag" resultType="java.lang.Long"> | |||
| select count(user_id) from wx_c_user_tags where JSON_CONTAINS(tags,JSON_ARRAY(#{list}) ); | |||
| </select> | |||
| <select id ="findUserByTag" resultType="java.lang.Long"> | |||
| select user_id from wx_c_user_tags where JSON_CONTAINS(tags,JSON_ARRAY(#{list}) ); | |||
| </select> | |||
| </mapper> | |||
| @@ -0,0 +1,146 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.simple.mapper.WxCampaignMapper"> | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxCampaign"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="cover_img" jdbcType="VARCHAR" property="coverImg" /> | |||
| <result column="title" jdbcType="VARCHAR" property="title" /> | |||
| <result column="sub_title" jdbcType="VARCHAR" property="subTitle" /> | |||
| <result column="use_price" jdbcType="INTEGER" property="usePrice" /> | |||
| <result column="discount_price" jdbcType="INTEGER" property="discountPrice" /> | |||
| <result column="detail" jdbcType="VARCHAR" property="detail" /> | |||
| <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate" /> | |||
| <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate" /> | |||
| <result column="img_detail" jdbcType="VARCHAR" property="imgDetail" /> | |||
| <result column="type" jdbcType="INTEGER" property="type" /> | |||
| <result column="coupon_ids" jdbcType="VARCHAR" property="couponIds" /> | |||
| <result column="mechant_id" jdbcType="BIGINT" property="mechantId" /> | |||
| <result column="sort_num" jdbcType="INTEGER" property="sortNum" /> | |||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`cover_img`,`title`,`sub_title`,`use_price`,`discount_price`,`detail`,`valid_start_date`,`valid_end_date`,`img_detail`,`type`,`coupon_ids`,`mechant_id`,`sort_num`,`status`,`create_time`,`update_time` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||
| </if> | |||
| <if test=" null != coverImg "> | |||
| and `cover_img` like concat('%', #{coverImg},'%') | |||
| </if> | |||
| <if test=" null != title "> | |||
| and `title` like concat('%', #{title},'%') | |||
| </if> | |||
| <if test=" null != subTitle "> | |||
| and `sub_title` like concat('%', #{subTitle},'%') | |||
| </if> | |||
| <if test=" null != usePrice "> | |||
| and `use_price` = #{usePrice} | |||
| </if> | |||
| <if test=" null != discountPrice "> | |||
| and `discount_price` = #{discountPrice} | |||
| </if> | |||
| <if test=" null != detail "> | |||
| and `detail` like concat('%', #{detail},'%') | |||
| </if> | |||
| <if test=" null != validStartDate "> | |||
| and `valid_start_date` = #{validStartDate} | |||
| </if> | |||
| <if test=" null != validEndDate "> | |||
| and `valid_end_date` = #{validEndDate} | |||
| </if> | |||
| <if test=" null != imgDetail "> | |||
| and `img_detail` like concat('%', #{imgDetail},'%') | |||
| </if> | |||
| <if test=" null != type "> | |||
| and `type` = #{type} | |||
| </if> | |||
| <if test=" null != couponIds "> | |||
| and `coupon_ids` like concat('%', #{couponIds},'%') | |||
| </if> | |||
| <if test=" null != mechantId "> | |||
| and `mechant_id` = #{mechantId} | |||
| </if> | |||
| <if test=" null != sortNum "> | |||
| and `sort_num` = #{sortNum} | |||
| </if> | |||
| <if test=" null != status "> | |||
| and `status` = #{status} | |||
| </if> | |||
| <if test=" null != createTime "> | |||
| and `create_time` = #{createTime} | |||
| </if> | |||
| <if test=" null != updateTime "> | |||
| and `update_time` = #{updateTime} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.simple.domain.po.WxCampaign" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_campaign | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="getMaxSortNum" parameterType="java.lang.String" resultType="java.lang.Integer"> | |||
| select max(sort_num) from wx_campaign where `tenant_id` = #{tenantId} | |||
| </select> | |||
| </mapper> | |||
| @@ -90,7 +90,12 @@ | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <update id="updateAmount" parameterType="com.simple.domain.po.WxDateAmountRecord"> | |||
| update wx_date_amount_record set pay_price=pay_price+#{payPrice} | |||
| where tenant_id=#{tenantId} and merchant_id=#{merchantId} | |||
| and type=#{type} and date = #{date} | |||
| </update> | |||
| @@ -16,10 +16,12 @@ | |||
| <result column="park_area" jdbcType="DECIMAL" property="parkArea" /> | |||
| <result column="park_place_number" jdbcType="INTEGER" property="parkPlaceNumber" /> | |||
| <result column="pay_id" jdbcType="BIGINT" property="payId" /> | |||
| <result column="service_phone" jdbcType="VARCHAR" property="servicePhone" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`name`,`group`,`country`,`province`,`city`,`addr`,`wiwide_id`,`total_area`,`operating_area`,`park_area`,`park_place_number`,`pay_id` | |||
| `id`,`tenant_id`,`name`,`group`,`country`,`province`,`city`,`addr`,`wiwide_id`,`total_area`,`operating_area`,`park_area`,`park_place_number`,`pay_id`,`service_phone` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -93,7 +95,11 @@ | |||
| <if test=" null != payId "> | |||
| and `pay_id` = #{payId} | |||
| </if> | |||
| </if> | |||
| <if test=" null != servicePhone "> | |||
| and `service_phone` = #{servicePhone} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| @@ -13,10 +13,12 @@ | |||
| <result column="app_id" jdbcType="VARCHAR" property="appId" /> | |||
| <result column="token" jdbcType="VARCHAR" property="token" /> | |||
| <result column="expire_time" jdbcType="TIMESTAMP" property="expireTime" /> | |||
| <result column="name" jdbcType="VARCHAR" property="name" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`b_user_id`,`phone`,`b_user_pwd`,`merchant_id`,`create_date`,`update_date`,`app_id`,`token`,`expire_time` | |||
| `id`,`tenant_id`,`b_user_id`,`phone`,`b_user_pwd`,`merchant_id`,`create_date`,`update_date`,`app_id`,`token`,`expire_time`,`name` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -75,7 +77,10 @@ | |||
| <if test=" null != expireTime "> | |||
| and `expire_time` = #{expireTime} | |||
| </if> | |||
| </if> | |||
| <if test=" null != name "> | |||
| and `name` = #{name} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| @@ -15,10 +15,15 @@ | |||
| <result column="reminder" jdbcType="BIGINT" property="reminder" /> | |||
| <result column="phone" jdbcType="VARCHAR" property="phone" /> | |||
| <result column="notifyurl" jdbcType="VARCHAR" property="notifyurl" /> | |||
| <result column="modelnotifyurl" jdbcType="VARCHAR" property="modelnotifyurl" /> | |||
| <result column="verifynotifyurl" jdbcType="VARCHAR" property="verifynotifyurl" /> | |||
| <result column="appid" jdbcType="VARCHAR" property="appid" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`secret`,`publickey`,`bid`,`recharge`,`remains`,`total`,`account`,`reminderstatus`,`reminder`,`phone`,`notifyurl` | |||
| `id`,`tenant_id`,`secret`,`publickey`,`bid`,`recharge`,`remains`,`total`,`account`,`reminderstatus`,`reminder`,`phone`,`notifyurl`,`modelnotifyurl`,`verifynotifyurl`,`appid` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -87,7 +92,13 @@ | |||
| <if test=" null != notifyurl "> | |||
| and `notifyurl` like concat('%', #{notifyurl},'%') | |||
| </if> | |||
| </if> | |||
| <if test=" null != appid "> | |||
| and `appid` = #{appid} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| @@ -9,10 +9,12 @@ | |||
| <result column="content" jdbcType="VARCHAR" property="content" /> | |||
| <result column="createtime" jdbcType="TIMESTAMP" property="createtime" /> | |||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||
| <result column="model_id" jdbcType="INTEGER" property="modelId" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`name`,`signature`,`content`,`createtime`,`status` | |||
| `id`,`tenant_id`,`name`,`signature`,`content`,`createtime`,`status`,`model_id` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -51,7 +53,11 @@ | |||
| <if test=" null != status "> | |||
| and `status` = #{status} | |||
| </if> | |||
| </if> | |||
| <if test=" null != modelId"> | |||
| and `model_id` = #{modelId} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| @@ -65,7 +71,8 @@ | |||
| select <include refid="allColumns" /> from wx_msg_model | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| @@ -11,10 +11,12 @@ | |||
| <result column="msg" jdbcType="VARCHAR" property="msg" /> | |||
| <result column="signature" jdbcType="VARCHAR" property="signature" /> | |||
| <result column="code" jdbcType="VARCHAR" property="code" /> | |||
| <result column="appid" jdbcType="VARCHAR" property="appid" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`phone`,`expiretime`,`createtime`,`type`,`tenant_id`,`msg`,`signature`,`code` | |||
| `id`,`phone`,`expiretime`,`createtime`,`type`,`tenant_id`,`msg`,`signature`,`code`,`appid` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -0,0 +1,53 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.simple.mapper.WxMsgValidationcodeModelMapper"> | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxMsgValidationcodeModel"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="name" jdbcType="VARCHAR" property="name" /> | |||
| <result column="signature" jdbcType="VARCHAR" property="signature" /> | |||
| <result column="content" jdbcType="VARCHAR" property="content" /> | |||
| <result column="createtime" jdbcType="TIMESTAMP" property="createtime" /> | |||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||
| <result column="minutes" jdbcType="INTEGER" property="minutes" /> | |||
| <result column="model_id" jdbcType="INTEGER" property="modelId" /> | |||
| <result column="type" jdbcType="INTEGER" property="type" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`name`,`signature`,`content`,`createtime`,`status`,`minutes`,`model_id`,`type`,`tenant_id` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> and `id` = #{id} </if> | |||
| <if test=" null != name "> and `name` = #{name} </if> | |||
| <if test=" null != signature "> and `signature` = #{signature} </if> | |||
| <if test=" null != content "> and `content` = #{content} </if> | |||
| <if test=" null != createtime "> and `createtime` = #{createtime} </if> | |||
| <if test=" null != status "> and `status` = #{status} </if> | |||
| <if test=" null != minutes "> and `minutes` = #{minutes} </if> | |||
| <if test=" null != modelId "> and `model_id` = #{modelId} </if> | |||
| <if test=" null != type "> and `type` = #{type} </if> | |||
| <if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.simple.domain.po.WxMsgValidationcodeModel" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_msg_validationcode_model | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| </mapper> | |||
| @@ -71,7 +71,10 @@ | |||
| </select> | |||
| <select id="findType2Value" parameterType="String" resultMap="BaseResultMap"> | |||
| select DISTINCT type2 from wx_tags where type1=#{type1} | |||
| select DISTINCT type2 from wx_tags where 1=1 | |||
| <if test="_parameter!= null and _parameter!= ''"> | |||
| and type1=#{type1} | |||
| </if> | |||
| </select> | |||
| </mapper> | |||