| @@ -14,11 +14,6 @@ public class PayProperty { | |||
| */ | |||
| private boolean real; | |||
| /** | |||
| * 是否分账 | |||
| */ | |||
| private boolean share; | |||
| public boolean isReal() { | |||
| return real; | |||
| } | |||
| @@ -26,12 +21,4 @@ public class PayProperty { | |||
| public void setReal(boolean real) { | |||
| this.real = real; | |||
| } | |||
| public boolean isShare() { | |||
| return share; | |||
| } | |||
| public void setShare(boolean share) { | |||
| this.share = share; | |||
| } | |||
| } | |||
| @@ -0,0 +1,67 @@ | |||
| package com.simple.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxBillRent; | |||
| import com.simple.service.WxBillRentService; | |||
| 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.*; | |||
| import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("wxBillRent") | |||
| public class WxBillRentController extends BaseController | |||
| { | |||
| @Autowired | |||
| private WxBillRentService wxBillRentService; | |||
| private Logger logger = Logger.getLogger(WxBillRentController.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 WxBillRent wxBillRent,Integer pageNum, Integer pageSize) { | |||
| if (null == wxBillRent) wxBillRent = new WxBillRent(); | |||
| wxBillRent.setTenantId(getTenantId()); | |||
| wxBillRent.setSortColumns(WxBillRent.Field.Id_DESC); | |||
| final PageInfo<Map<String, Object>> page = wxBillRentService.listAsPage(wxBillRent, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxBillRent wxBillRent) { | |||
| //Assert.notNull(wxBillRent.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxBillRent.setTenantId(getTenantId()); | |||
| wxBillRentService.saveOrUpdate(wxBillRent); | |||
| return new ResultData(ResultData.SUCCESS,"操作成功"); | |||
| } | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxBillRent wxBillRent) { | |||
| wxBillRentService.saveOrUpdate(wxBillRent); | |||
| return new ResultData(ResultData.SUCCESS,"操作成功"); | |||
| } | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="String", paramType = "query",required=true) | |||
| public ResultData delete(String id) { | |||
| wxBillRentService.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,"查询成功",wxBillRentService.getById(id)); | |||
| } | |||
| } | |||
| @@ -1,108 +1,85 @@ | |||
| package com.simple.controller; | |||
| import java.text.NumberFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.Calendar; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| 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.ModelAttribute; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| 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.dto.WxCuerBasicInfoDto; | |||
| import com.simple.domain.po.WxCUser; | |||
| import com.simple.domain.po.WxCUserBasicInfo; | |||
| import com.simple.domain.po.WxCUserTags; | |||
| import com.simple.domain.po.WxCoupon; | |||
| import com.simple.domain.po.WxCouponOrder; | |||
| import com.simple.domain.po.WxTags; | |||
| import com.simple.domain.vo.UserStructureVo; | |||
| import com.simple.enums.EnumAgeInfo; | |||
| import com.simple.service.WxCUserBasicInfoService; | |||
| import com.simple.service.WxCUserService; | |||
| import com.simple.service.WxCUserTagsService; | |||
| import com.simple.service.WxCouponOrderService; | |||
| import com.simple.service.WxCouponService; | |||
| import com.simple.service.WxTagsService; | |||
| import com.simple.domain.dto.WxCUserBasicInfoDto; | |||
| import com.simple.domain.po.*; | |||
| import com.simple.service.*; | |||
| 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; | |||
| @RestController | |||
| @RequestMapping("wxCUserBasicInfo") | |||
| @Api(description="会员管理相关接口") | |||
| public class WxCUserBasicInfoController extends BaseController | |||
| { | |||
| @Autowired | |||
| @Api(description = "会员管理相关接口") | |||
| public class WxCUserBasicInfoController extends BaseController { | |||
| @Autowired | |||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @Autowired | |||
| private WxCUserTagsService wxCUserTagsService; | |||
| @Autowired | |||
| private WxTagsService wxTagsService; | |||
| @Autowired | |||
| private WxCUserService wxCUserService; | |||
| @Autowired | |||
| private WxCouponOrderService wxCouponOrderService; | |||
| @Autowired | |||
| private WxCouponService wxCouponService; | |||
| @Autowired | |||
| private WxCUserTagsService wxCUserTagsService; | |||
| @Autowired | |||
| private WxTagsService wxTagsService; | |||
| @Autowired | |||
| private WxCUserService wxCUserService; | |||
| @Autowired | |||
| private WxCouponOrderService wxCouponOrderService; | |||
| @Autowired | |||
| private WxCouponService wxCouponService; | |||
| private Logger logger = Logger.getLogger(WxCUserBasicInfoController.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 WxCuerBasicInfoDto wxCUserBasicInfo,Integer pageNum, Integer pageSize) { | |||
| if (null == wxCUserBasicInfo) wxCUserBasicInfo = new WxCuerBasicInfoDto(); | |||
| String tenantId = getTenantId(); | |||
| wxCUserBasicInfo.setTenantId(tenantId); | |||
| @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 WxCUserBasicInfoDto wxCUserBasicInfo, Integer pageNum, Integer pageSize) { | |||
| if (null == wxCUserBasicInfo) wxCUserBasicInfo = new WxCUserBasicInfoDto(); | |||
| String tenantId = getTenantId(); | |||
| wxCUserBasicInfo.setTenantId(tenantId); | |||
| PageInfo<WxCUserBasicInfo> page = wxCUserBasicInfoService.list(wxCUserBasicInfo, pageNum, pageSize); | |||
| if(page.getSize()==0 && StringUtils.isNotBlank(wxCUserBasicInfo.getPhone()) | |||
| && wxCUserBasicInfo.getEndTime()==null && wxCUserBasicInfo.getStartTime()==null | |||
| && StringUtils.isBlank(wxCUserBasicInfo.getName()) | |||
| ) {//当只有手机号查询并且查不到数据 ,新增 | |||
| WxCUser cUser = new WxCUser(); | |||
| cUser.setTenantId(tenantId); | |||
| cUser.setPhone(wxCUserBasicInfo.getPhone()); | |||
| PageInfo<WxCUser> cUsers = wxCUserService.listAsPage(cUser, 1, 1); | |||
| if(cUsers.getSize()>0) { | |||
| createUserBasicInfo(cUsers.getList().get(0)); | |||
| page = wxCUserBasicInfoService.list(wxCUserBasicInfo, pageNum, pageSize); | |||
| } | |||
| if (page.getSize() == 0 && StringUtils.isNotBlank(wxCUserBasicInfo.getPhone()) | |||
| && wxCUserBasicInfo.getEndTime() == null && wxCUserBasicInfo.getStartTime() == null | |||
| && StringUtils.isBlank(wxCUserBasicInfo.getName()) | |||
| ) {//当只有手机号查询并且查不到数据 ,新增 | |||
| WxCUser cUser = new WxCUser(); | |||
| cUser.setTenantId(tenantId); | |||
| cUser.setPhone(wxCUserBasicInfo.getPhone()); | |||
| PageInfo<WxCUser> cUsers = wxCUserService.listAsPage(cUser, 1, 1); | |||
| if (cUsers.getSize() > 0) { | |||
| createUserBasicInfo(cUsers.getList().get(0)); | |||
| page = wxCUserBasicInfoService.list(wxCUserBasicInfo, pageNum, pageSize); | |||
| } | |||
| } | |||
| return new ResultData(page); | |||
| } | |||
| private void createUserBasicInfo(WxCUser wxCUser) { | |||
| WxCUserBasicInfo wxCUserBasicInfo =new WxCUserBasicInfo(); | |||
| wxCUserBasicInfo.setCUserId(wxCUser.getId()); | |||
| wxCUserBasicInfo.setPhone(wxCUser.getPhone()); | |||
| wxCUserBasicInfo.setTenantId(wxCUser.getTenantId()); | |||
| wxCUserBasicInfo.setNickName(wxCUser.getNickName()); | |||
| wxCUserBasicInfoService.saveOrUpdate(wxCUserBasicInfo); | |||
| } | |||
| private void createUserBasicInfo(WxCUser wxCUser) { | |||
| WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo(); | |||
| wxCUserBasicInfo.setId(wxCUser.getId()); | |||
| wxCUserBasicInfo.setPhone(wxCUser.getPhone()); | |||
| wxCUserBasicInfo.setTenantId(wxCUser.getTenantId()); | |||
| wxCUserBasicInfo.setNickName(wxCUser.getNickName()); | |||
| wxCUserBasicInfoService.saveOrUpdate(wxCUserBasicInfo); | |||
| } | |||
| // @ApiOperation("新增接口") | |||
| // @PostMapping("add") | |||
| @@ -116,89 +93,98 @@ public class WxCUserBasicInfoController extends BaseController | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxCUserBasicInfo wxCUserBasicInfo) { | |||
| WxCUserBasicInfo info = wxCUserBasicInfoService.getById(wxCUserBasicInfo.getId()); | |||
| wxCUserBasicInfo.setTenantId(getTenantId()); | |||
| if(StringUtils.isNotBlank(wxCUserBasicInfo.getTagIds())) { | |||
| WxCUserTags record =new WxCUserTags(); | |||
| record.setUserId(info.getCUserId()); | |||
| record.setTenantId(getTenantId()); | |||
| 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.getTagIds(); | |||
| 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()); | |||
| } | |||
| WxCUserBasicInfo info = wxCUserBasicInfoService.getById(wxCUserBasicInfo.getId()); | |||
| wxCUserBasicInfo.setTenantId(getTenantId()); | |||
| if (StringUtils.isNotBlank(wxCUserBasicInfo.getTagIds())) { | |||
| WxCUserTags record = new WxCUserTags(); | |||
| record.setUserId(info.getId()); | |||
| record.setTenantId(getTenantId()); | |||
| 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.getTagIds(); | |||
| 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()); | |||
| } | |||
| wxCUserBasicInfoService.saveOrUpdate(wxCUserBasicInfo); | |||
| return new ResultData(); | |||
| } | |||
| @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) { | |||
| wxCUserBasicInfoService.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) { | |||
| WxCUserBasicInfo info = wxCUserBasicInfoService.getById(id); | |||
| if(info.getTagId()!=null) { | |||
| WxCUserTags uTag = wxCUserTagsService.getById(info.getTagId()); | |||
| 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); | |||
| String tagNames=""; | |||
| String tagIds=""; | |||
| List<Long> tagIdList = new ArrayList<>(); | |||
| for(WxTags wt:page.getList()) { | |||
| tagNames+=wt.getName()+"/"; | |||
| tagIds+=wt.getId()+","; | |||
| tagIdList.add(wt.getId()); | |||
| } | |||
| if(StringUtils.isNotBlank(tagNames)) { | |||
| info.setTagNames(tagNames.substring(0,tagNames.length()-1)); | |||
| } | |||
| if(StringUtils.isNoneBlank(tagIds)) { | |||
| info.setTagIds(tagIds.substring(0,tagIds.length()-1)); | |||
| } | |||
| long count = wxCUserTagsService.findCountByTag(tagIdList); | |||
| info.setCount(count); | |||
| } | |||
| } | |||
| return new ResultData(Result.SUCCESS,"查询成功",info); | |||
| WxCUserBasicInfo info = wxCUserBasicInfoService.getById(id); | |||
| if (info != null && info.getTagId() != null) { | |||
| WxCUserTags uTag = wxCUserTagsService.getById(info.getTagId()); | |||
| 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); | |||
| String tagNames = ""; | |||
| String tagIds = ""; | |||
| List<Long> tagIdList = new ArrayList<>(); | |||
| for (WxTags wt : page.getList()) { | |||
| tagNames += wt.getName() + "/"; | |||
| tagIds += wt.getId() + ","; | |||
| tagIdList.add(wt.getId()); | |||
| } | |||
| if (StringUtils.isNotBlank(tagNames)) { | |||
| info.setTagNames(tagNames.substring(0, tagNames.length() - 1)); | |||
| } | |||
| if (StringUtils.isNoneBlank(tagIds)) { | |||
| info.setTagIds(tagIds.substring(0, tagIds.length() - 1)); | |||
| } | |||
| long count = wxCUserTagsService.findCountByTag(tagIdList); | |||
| info.setCount(count); | |||
| } | |||
| } else { | |||
| info = new WxCUserBasicInfo(); | |||
| info.setId(id); | |||
| WxCUser user = wxCUserService.getById(id); | |||
| if (user != null) { | |||
| info.setTenantId(user.getTenantId()); | |||
| info.setPhone(user.getPhone()); | |||
| info.setSex(user.getGender()); | |||
| } | |||
| } | |||
| return new ResultData(Result.SUCCESS, "查询成功", info); | |||
| } | |||
| @ApiOperation("根据userId查询交易记录接口") | |||
| @GetMapping("/findOrderCouponByUserId") | |||
| @ApiImplicitParam(name = "userId", value = "userId", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findOrderCouponByUserId(Long userId, Integer pageNum, Integer pageSize) { | |||
| WxCouponOrder corder = new WxCouponOrder(); | |||
| corder.setCUserId(userId); | |||
| corder.setTenantId(getTenantId()); | |||
| PageInfo<WxCouponOrder> page = wxCouponOrderService.listAsPage(corder, pageNum, pageSize); | |||
| if (page.getSize() > 0) { | |||
| List<WxCouponOrder> list = page.getList(); | |||
| for (WxCouponOrder c : list) { | |||
| WxCoupon coupon = wxCouponService.getById(c.getCouponId()); | |||
| c.setCouponName(coupon.getTitle()); | |||
| c.setSalePrice(coupon.getPrice()); | |||
| } | |||
| } | |||
| return new ResultData(Result.SUCCESS, "查询成功", page); | |||
| } | |||
| @ApiOperation("根据userId查询交易记录接口") | |||
| @GetMapping("/findOrderCouponByUserId") | |||
| @ApiImplicitParam(name="userId",value="userId",dataType="Long", paramType = "query",required=true) | |||
| public ResultData findOrderCouponByUserId(Long userId,Integer pageNum, Integer pageSize) { | |||
| WxCouponOrder corder = new WxCouponOrder(); | |||
| corder.setCUserId(userId); | |||
| corder.setTenantId(getTenantId()); | |||
| PageInfo<WxCouponOrder> page = wxCouponOrderService.listAsPage(corder, pageNum, pageSize); | |||
| if(page.getSize()>0) { | |||
| List<WxCouponOrder> list = page.getList(); | |||
| for(WxCouponOrder c:list) { | |||
| WxCoupon coupon = wxCouponService.getById(c.getCouponId()); | |||
| c.setCouponName(coupon.getTitle()); | |||
| c.setSalePrice(coupon.getPrice()); | |||
| } | |||
| } | |||
| return new ResultData(Result.SUCCESS,"查询成功",page); | |||
| } | |||
| } | |||
| @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.dto.WxCuerBasicInfoDto; | |||
| import com.simple.domain.dto.WxCUserBasicInfoDto; | |||
| import com.simple.domain.vo.CUserDateAmountVo; | |||
| import com.simple.domain.vo.TouchUsersReportVo; | |||
| import com.simple.domain.vo.UserStructureVo; | |||
| @@ -42,7 +42,7 @@ public class WxCUserDataController extends BaseController{ | |||
| @GetMapping("findUserCountData") | |||
| @ApiOperation("查询用户数量接口") | |||
| public ResultData findUserCountData() { | |||
| WxCuerBasicInfoDto dto = new WxCuerBasicInfoDto(); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| long allCount = wxCUserService.findCount(dto);//总数 | |||
| Calendar c = Calendar.getInstance(); | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| @@ -67,13 +67,13 @@ public class WxPayController extends BaseController { | |||
| paramMap = WxPayment.xmlToMap(resultxml); | |||
| logger.info("微信支付回调, notify, param: " + paramMap.toString() ); | |||
| String response = wxPayOrderService.notify(paramMap, EnumPayWay.PAY_WAY_WEAPP); | |||
| logger.info("微信支付回调, notify success, req : " + paramMap.toString() + ", resp: " + response.toString()); | |||
| logger.info("微信支付回调, notify success, req : " + resultxml + ", resp: " + response.toString()); | |||
| return response; | |||
| } catch (BizMessageException e) { | |||
| if (paramMap == null) { | |||
| logger.error("微信支付回调, order create error, e: " + e.getMessage()); | |||
| } else { | |||
| logger.error("微信支付回调, order create error, req: " + paramMap.toString() + ", e: " + e.getMessage()); | |||
| logger.error("微信支付回调, order create error, req: " + resultxml + ", e: " + e.getMessage()); | |||
| } | |||
| SortedMap resultMap = new TreeMap<>(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| @@ -83,7 +83,7 @@ public class WxPayController extends BaseController { | |||
| if (paramMap == null) { | |||
| logger.error("微信支付回调, order create error, e: " + e.getMessage()); | |||
| } else { | |||
| logger.error("微信支付回调, order create error, req: " + paramMap.toString() + ", e: " + e.getMessage()); | |||
| logger.error("微信支付回调, order create error, req: " + resultxml + ", e: " + e.getMessage()); | |||
| } | |||
| SortedMap resultMap = new TreeMap<>(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| @@ -93,7 +93,7 @@ public class WxPayController extends BaseController { | |||
| if (paramMap == null) { | |||
| logger.error("微信支付回调, order create error, e: " + e.getMessage()); | |||
| } else { | |||
| logger.error("微信支付回调, order create error, req: " + paramMap.toString() + ", e: " + e.getMessage()); | |||
| logger.error("微信支付回调, order create error, req: " + resultxml + ", e: " + e.getMessage()); | |||
| } | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| @@ -111,28 +111,29 @@ public class WxPayController extends BaseController { | |||
| @RequestMapping(value = "/refund") | |||
| public String __refundNotify(HttpServletRequest request) throws Exception { | |||
| Map<String, String> paramMap = null; | |||
| String response; | |||
| String response = ""; | |||
| String xml = ""; | |||
| try { | |||
| String xml = IOUtils.toString(request.getInputStream(), Charset.forName("UTF-8")); | |||
| xml = IOUtils.toString(request.getInputStream(), Charset.forName("UTF-8")); | |||
| logger.info(xml); | |||
| paramMap = WxPayment.xmlToMap(xml); | |||
| logger.info("refund wxpay, notify, param: " + paramMap.toString() ); | |||
| response = wxRefundOrderService.notify(paramMap, EnumPayWay.PAY_WAY_WEAPP); | |||
| logger.info("refund wxpay, notify success, req : " + paramMap.toString() + ", resp: " + response.toString()); | |||
| logger.info("refund wxpay, notify success, req : " + xml + ", resp: " + response.toString()); | |||
| return response; | |||
| } catch (BizMessageException e) { | |||
| logger.error("refund wxpay, notify error, req: " + paramMap.toString() + ", e:" + e.getLocalizedMessage()); | |||
| logger.error("refund wxpay, notify error, req: " + xml + ", e:" + e.getLocalizedMessage()); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", e.getMessage()); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } catch (MallinkException e) { | |||
| logger.error("refund wxpay, notify error, req: " + paramMap.toString() + ", e:" +e.getLocalizedMessage()); | |||
| logger.error("refund wxpay, notify error, req: " + xml + ", e:" +e.getLocalizedMessage()); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", e.getMessage()); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } catch (Exception e) { | |||
| logger.error("refund wxpay, order create error, req: " + paramMap.toString() + ", e: " + e.getMessage()); | |||
| logger.error("refund wxpay, order create error, req: " + xml + ", e: " + e.getMessage()); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", e.getMessage()); | |||
| @@ -148,28 +149,29 @@ public class WxPayController extends BaseController { | |||
| @RequestMapping(value = "/sharing") | |||
| public String __shareNotify(HttpServletRequest request) throws Exception { | |||
| Map<String, String> paramMap = null; | |||
| String response; | |||
| String response = ""; | |||
| String xml = ""; | |||
| try { | |||
| String xml = IOUtils.toString(request.getInputStream(), Charset.forName("UTF-8")); | |||
| xml = IOUtils.toString(request.getInputStream(), Charset.forName("UTF-8")); | |||
| paramMap = WxPayment.xmlToMap(xml); | |||
| logger.info("share wxpay, notify, param: " + paramMap.toString() ); | |||
| logger.info("share wxpay, notify, param: " + xml ); | |||
| response = wxPayOrderService.notify(paramMap, EnumPayWay.PAY_WAY_WEAPP); | |||
| logger.info("share wxpay, notify success, req : " + paramMap.toString() + ", resp: " + response.toString()); | |||
| logger.info("share wxpay, notify success, req : " + xml + ", resp: " + response.toString()); | |||
| return response; | |||
| } catch (BizMessageException e) { | |||
| logger.error("share wxpay, notify error, req: " + paramMap.toString() + ", e:" + e.getLocalizedMessage()); | |||
| logger.error("share wxpay, notify error, req: " + xml + ", e:" + e.getLocalizedMessage()); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", e.getMessage()); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } catch (MallinkException e) { | |||
| logger.error("refund wxpay, notify error, req: " + paramMap.toString() + ", e:" +e.getLocalizedMessage()); | |||
| logger.error("refund wxpay, notify error, req: " + xml + ", e:" +e.getLocalizedMessage()); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", e.getMessage()); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } catch (Exception e) { | |||
| logger.error("refund wxpay, order create error, req: " + paramMap.toString() + ", e: " + e.getMessage()); | |||
| logger.error("refund wxpay, order create error, req: " + xml + ", e: " + e.getMessage()); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", e.getMessage()); | |||
| @@ -41,7 +41,7 @@ public class WxProfitSharingReceiverController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxProfitSharingReceiver receiver) { | |||
| public ResultData add(@ModelAttribute WxProfitSharingReceiver receiver) { | |||
| if (receiver == null) | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| @@ -53,6 +53,8 @@ public class WxProfitSharingReceiverController extends BaseController { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||
| if (receiver.getReceiverAccount() == null) | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||
| if (receiver.getTrueName() == null) | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||
| WxMerchant merchant = wxMerchantService.getById(receiver.getMerchantId()); | |||
| if (merchant == null) | |||
| @@ -64,7 +66,7 @@ public class WxProfitSharingReceiverController extends BaseController { | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("del") | |||
| public ResultData delete(@RequestBody WxProfitSharingReceiver receiver) { | |||
| public ResultData delete(@ModelAttribute WxProfitSharingReceiver receiver) { | |||
| if (receiver == null) | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| if (receiver.getMerchantId() == null) | |||
| @@ -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.WxRentContract; | |||
| import com.simple.service.WxRentContractService; | |||
| 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("wxRentContract") | |||
| public class WxRentContractController extends BaseController | |||
| { | |||
| @Autowired | |||
| private WxRentContractService wxRentContractService; | |||
| private Logger logger = Logger.getLogger(WxRentContractController.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 WxRentContract wxRentContract,Integer pageNum, Integer pageSize) { | |||
| if (null == wxRentContract) wxRentContract = new WxRentContract(); | |||
| final PageInfo<WxRentContract> page = wxRentContractService.listAsPage(wxRentContract, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxRentContract wxRentContract) { | |||
| //Assert.notNull(wxRentContract.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxRentContractService.saveOrUpdate(wxRentContract); | |||
| return new ResultData(); | |||
| } | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxRentContract wxRentContract) { | |||
| wxRentContractService.saveOrUpdate(wxRentContract); | |||
| return new ResultData(); | |||
| } | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="String", paramType = "query",required=true) | |||
| public ResultData delete(String id) { | |||
| wxRentContractService.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,"查询成功",wxRentContractService.getById(id)); | |||
| } | |||
| } | |||
| @@ -69,7 +69,20 @@ public class WxShopController extends BaseController | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxShopService.getById(id)); | |||
| } | |||
| @ApiOperation("获取商铺数据") | |||
| @GetMapping("getShopListByShopNumber") | |||
| @ApiImplicitParam(name="shopNumber",value="shopNumber",dataType="String", paramType = "query",required=true) | |||
| public ResultData getbshoplist(String shopNumber) { | |||
| return wxShopService.getbshoplist(getTenantId(),shopNumber); | |||
| } | |||
| @ApiOperation("获取商户商铺数据") | |||
| @GetMapping("getMerchantShopByShopId") | |||
| @ApiImplicitParam(name="shopId",value="shopId",dataType="String", paramType = "query",required=true) | |||
| public ResultData getMerchantShopByShopId(String shopId) { | |||
| return wxShopService.getMerchantShopByShopId(getTenantId(),shopId); | |||
| } | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| package com.simple.controller; | |||
| import java.text.NumberFormat; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.ArrayList; | |||
| @@ -11,21 +11,13 @@ import java.util.Map; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.http.HttpEntity; | |||
| import org.springframework.http.HttpHeaders; | |||
| import org.springframework.http.MediaType; | |||
| import org.springframework.http.ResponseEntity; | |||
| import org.springframework.util.LinkedMultiValueMap; | |||
| import org.springframework.util.MultiValueMap; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import org.springframework.web.client.RestTemplate; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.dto.WxCuerBasicInfoDto; | |||
| import com.simple.domain.dto.WxCUserBasicInfoDto; | |||
| import com.simple.domain.po.WxCUser; | |||
| import com.simple.domain.po.WxUserChannel; | |||
| import com.simple.domain.vo.UserStructureVo; | |||
| @@ -57,7 +49,7 @@ public class WxUserStructureController extends BaseController{ | |||
| public ResultData findUserSexStructure( | |||
| Date startTime,Date endTime | |||
| ) { | |||
| WxCuerBasicInfoDto dto = new WxCuerBasicInfoDto(); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.setTenantId(getTenantId()); | |||
| dto.setStartTime(startTime); | |||
| if(endTime!=null) { | |||
| @@ -84,7 +76,7 @@ public class WxUserStructureController extends BaseController{ | |||
| @ApiOperation("查询会员年龄结构") | |||
| @GetMapping("/findUserAgeStructure") | |||
| public ResultData findUserAgeStructure( Date startTime,Date endTime) { | |||
| WxCuerBasicInfoDto dto = new WxCuerBasicInfoDto(); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.setTenantId(getTenantId()); | |||
| dto.setStartTime(startTime); | |||
| if(endTime!=null) { | |||
| @@ -112,7 +104,7 @@ public class WxUserStructureController extends BaseController{ | |||
| @ApiOperation("查询会员数量") | |||
| @GetMapping("/findUserDataCount") | |||
| public ResultData findUserCount(Date startTime,Date endTime) { | |||
| WxCuerBasicInfoDto dto = new WxCuerBasicInfoDto(); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.setTenantId(getTenantId()); | |||
| dto.setStartTime(startTime); | |||
| if(endTime!=null) { | |||
| @@ -217,9 +209,9 @@ public class WxUserStructureController extends BaseController{ | |||
| } | |||
| return new ResultData(vos); | |||
| } | |||
| private long getCountByAge(EnumAgeInfo a,Calendar c, WxCuerBasicInfoDto dto ) { | |||
| private long getCountByAge(EnumAgeInfo a,Calendar c, WxCUserBasicInfoDto dto ) { | |||
| c.add(Calendar.YEAR, -a.getEnd()); | |||
| Date startTime = c.getTime(); | |||
| c.clear(); | |||
| @@ -235,7 +227,7 @@ public class WxUserStructureController extends BaseController{ | |||
| //通过性别获取数量 | |||
| private long getCount(WxCuerBasicInfoDto dto) { | |||
| private long getCount(WxCUserBasicInfoDto dto) { | |||
| // wxCUserBasicInfoService.findCountBySex(dto) basic表与cuser表示对应的,先有cuser 才有basic | |||
| //所有这里不需要再去查basic | |||
| return wxCUserService.findCount(dto); | |||
| @@ -6,7 +6,7 @@ import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| import com.simple.enums.EnumAppType; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.http.HttpEntity; | |||
| @@ -23,6 +23,7 @@ import com.alibaba.fastjson.JSONObject; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.po.WxAppinfo; | |||
| import com.simple.domain.po.WxUserVisit; | |||
| import com.simple.enums.EnumAppType; | |||
| import com.simple.service.WxAppinfoService; | |||
| import com.simple.service.WxUserVisitService; | |||
| @@ -30,9 +31,6 @@ import com.simple.service.WxUserVisitService; | |||
| public class WxAppVisitSchedule { | |||
| private Logger logger = Logger.getLogger(WxAppVisitSchedule.class); | |||
| private static String token="https://api.weixin.qq.com/cgi-bin/token?"+ | |||
| "grant_type=client_credential&appid=APPID&secret=APPSECRET"; | |||
| private static String visit = "https://api.weixin.qq.com/datacube/getweanalysisappiddailyvisittrend?access_token="; | |||
| @@ -59,16 +57,16 @@ public class WxAppVisitSchedule { | |||
| appInfo.setType(EnumAppType.C.getCode()); | |||
| PageInfo<WxAppinfo> page = WxAppinfoService.listAsPage(appInfo, 1, 10000); | |||
| for(WxAppinfo w :page.getList()) { | |||
| w.getAppId(); | |||
| w.getSecret(); | |||
| w.getTenantId(); | |||
| //TODO 因为数据库表里数据问题,暂时不通过这种方式处理 | |||
| if(StringUtils.isBlank(w.getAppId())||StringUtils.isBlank(w.getSecret())) { | |||
| continue; | |||
| } | |||
| getData(yesterday,w.getAppId(),w.getSecret(),w.getTenantId()); | |||
| } | |||
| // TODO hardcode appId | |||
| String appId = "wx8eb8275b78db4ede"; | |||
| String key ="76c43df01296998d8ce12383f213ac10"; | |||
| String talentId ="456"; | |||
| getData(yesterday,appId,key,talentId); | |||
| // TODO hardcode appId | |||
| // String appId = "wx8eb8275b78db4ede"; | |||
| // String key ="76c43df01296998d8ce12383f213ac10"; | |||
| // String talentId ="456"; | |||
| // getData(yesterday,appId,key,talentId); | |||
| }catch(Exception e) { | |||
| logger.error("获取微信访问数据失败",e); | |||
| } | |||
| @@ -101,7 +99,8 @@ public class WxAppVisitSchedule { | |||
| logger.info(JSON.toJSONString(itemMap)); | |||
| WxUserVisit v = new WxUserVisit(); | |||
| // TODO hardcode appId | |||
| v.setAppId("wx8eb8275b78db4ede"); | |||
| // v.setAppId("wx8eb8275b78db4ede"); | |||
| v.setAppId(appId); | |||
| String time = itemMap.get("ref_date")+""; | |||
| Date date = new SimpleDateFormat("yyyyMMdd").parse(time); | |||
| v.setDayDate(date); | |||
| @@ -121,6 +120,8 @@ public class WxAppVisitSchedule { | |||
| private String getAccessToken(String appId,String appSecret) { | |||
| // return "13_rBo3ajS3jjd8OXZ2MLd4HfLrmt78gvaCeRtu-Xme0iC0fhs_lNS47aLPEwI8kfZQIMKnWYshY5wpaf2IoSI7tgVBm7WwVrm_Bg96J31VPKi8pEp8yB6JiTpDcWkpwv5GngiH2vDkwz7VHOsPLBYcAGAZPM"; | |||
| String token="https://api.weixin.qq.com/cgi-bin/token?"+ | |||
| "grant_type=client_credential&appid=APPID&secret=APPSECRET"; | |||
| String url = token.replace("APPID", appId). | |||
| replace("APPSECRET", appSecret); | |||
| Map<String,Object> map = restTemplate.getForObject(url,Map.class); | |||
| @@ -19,5 +19,15 @@ public class PasswordHelper { | |||
| user.setPassword(newPassword); | |||
| } | |||
| public static void main(String[] args) { | |||
| MallUserInfo user = new MallUserInfo(); | |||
| user.setUsername("sadmin"); | |||
| user.setPassword("sadmin123"); | |||
| PasswordHelper passwordHelper = new PasswordHelper(); | |||
| passwordHelper.encryptPassword(user); | |||
| System.out.println(user); | |||
| System.out.println(user.getPassword()); | |||
| } | |||
| } | |||
| @@ -39,5 +39,4 @@ mapper: | |||
| - com.simple.common.CommonMapper | |||
| pay: | |||
| real: true | |||
| share: false | |||
| real: true | |||
| @@ -14,11 +14,6 @@ public class PayProperty { | |||
| */ | |||
| private boolean real; | |||
| /** | |||
| * 是否分账 | |||
| */ | |||
| private boolean share; | |||
| public boolean isReal() { | |||
| return real; | |||
| } | |||
| @@ -26,12 +21,4 @@ public class PayProperty { | |||
| public void setReal(boolean real) { | |||
| this.real = real; | |||
| } | |||
| public boolean isShare() { | |||
| return share; | |||
| } | |||
| public void setShare(boolean share) { | |||
| this.share = share; | |||
| } | |||
| } | |||
| @@ -118,9 +118,9 @@ public class WxCouponOrderController extends BaseController { | |||
| logger.error("couponOrderId参数不正确: " + paramMap.toString()); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| WxCouponOrder couponOrder = null; | |||
| try { | |||
| ResultData rd = wxCouponOrderService.verify(couponOrderId, getUser().getId()); | |||
| return rd; | |||
| couponOrder = wxCouponOrderService.verify(couponOrderId, getUser().getId()); | |||
| } catch (MallinkException e) { | |||
| logger.error("核销异常: " + e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| @@ -128,6 +128,25 @@ public class WxCouponOrderController extends BaseController { | |||
| logger.error("核销异常: " + e.getMessage()); | |||
| return new ResultData(ErrorCode.VERIFY_ERROR, e.getMessage()); | |||
| } | |||
| // 核销分账 | |||
| if (couponOrder != null) { | |||
| try { | |||
| wxCouponOrderService.shareAfterVerify(couponOrder); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| } | |||
| // 核销发券 | |||
| if (couponOrder != null) { | |||
| try { | |||
| wxCouponOrderService.sendCouponAfterVerify(couponOrder, getUser()); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| } | |||
| return new ResultData(couponOrder); | |||
| } | |||
| @ApiOperation(value = "根据couponOrderId查询接口", notes = "{\"couponOrderId\":\"string\"}") | |||
| @@ -39,5 +39,4 @@ mapper: | |||
| - com.simple.common.CommonMapper | |||
| pay: | |||
| real: true | |||
| share: false | |||
| real: true | |||
| @@ -16,11 +16,6 @@ public class PayProperty { | |||
| */ | |||
| private boolean real; | |||
| /** | |||
| * 是否分账 | |||
| */ | |||
| private boolean share; | |||
| public boolean isReal() { | |||
| return real; | |||
| } | |||
| @@ -28,12 +23,4 @@ public class PayProperty { | |||
| public void setReal(boolean real) { | |||
| this.real = real; | |||
| } | |||
| public boolean isShare() { | |||
| return share; | |||
| } | |||
| public void setShare(boolean share) { | |||
| this.share = share; | |||
| } | |||
| } | |||
| @@ -72,7 +72,7 @@ public class WxPayOrderController extends BaseController { | |||
| try { | |||
| record.setIp(IPUtil.getIpAddr(request)); | |||
| return wxPayOrderService.createPayOrder(payProperty.isReal(), payProperty.isShare(), appInfo, user, record, EnumPayWay.PAY_WAY_WECHAT); | |||
| return wxPayOrderService.createPayOrder(payProperty.isReal(), appInfo, user, record, EnumPayWay.PAY_WAY_WECHAT); | |||
| } catch (MallinkException e) { | |||
| logger.error("payment wechat, order create error, req 2: " + record.toString() + ", e:" + e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| @@ -40,4 +40,3 @@ mapper: | |||
| pay: | |||
| real: true | |||
| share: false | |||
| @@ -158,7 +158,7 @@ public enum ErrorCode{ | |||
| PROFIT_SHARING_QUERY_APPLY_FAILED(12035, "分账查询业务失败"), | |||
| PROFIT_SHARING_QUERY_RETURN_INVALID(12036, "分账查询返回校验失败"), | |||
| PROFIT_SHARING_RECEIVER_ADD_FAILED(12037, "分账账户添加失败"), | |||
| PROFIT_SHARING_RECEIVER_DEL_FAILED(12037, "分账账户删除失败"), | |||
| PROFIT_SHARING_RECEIVER_DEL_FAILED(12038, "分账账户删除失败"), | |||
| /** | |||
| * 核销 | |||
| */ | |||
| @@ -1,109 +1,121 @@ | |||
| package com.simple.domain.dto; | |||
| import java.io.Serializable; | |||
| import java.util.Date; | |||
| import javax.persistence.Transient; | |||
| /** | |||
| * 用户查询dto | |||
| * @author jinguo | |||
| * | |||
| */ | |||
| public class WxCuerBasicInfoDto implements Serializable{ | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = -1116465873573690766L; | |||
| @io.swagger.annotations.ApiModelProperty(value="开始时间",name="startTime") | |||
| private Date startTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="结束时间",name="endTime") | |||
| private Date endTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="手机号",name="phone") | |||
| private String phone; | |||
| @io.swagger.annotations.ApiModelProperty(value="姓名",name="name") | |||
| private String name; | |||
| /*租户id**/ | |||
| // @io.swagger.annotations.ApiModelProperty(value="租户id",name="tenantId") | |||
| @Transient | |||
| private String tenantId; | |||
| @Transient | |||
| private Date birthStartTime; | |||
| @Transient | |||
| private Date birthEndTime; | |||
| @Transient | |||
| private Integer sex; | |||
| public Date getBirthStartTime() { | |||
| return birthStartTime; | |||
| } | |||
| public void setBirthStartTime(Date birthStartTime) { | |||
| this.birthStartTime = birthStartTime; | |||
| } | |||
| public Date getBirthEndTime() { | |||
| return birthEndTime; | |||
| } | |||
| public void setBirthEndTime(Date birthEndTime) { | |||
| this.birthEndTime = birthEndTime; | |||
| } | |||
| public Integer getSex() { | |||
| return sex; | |||
| } | |||
| public void setSex(Integer sex) { | |||
| this.sex = sex; | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| public void setName(String name) { | |||
| this.name = name; | |||
| } | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String tenantId) { | |||
| this.tenantId = tenantId; | |||
| } | |||
| public Date getStartTime() { | |||
| return startTime; | |||
| } | |||
| public void setStartTime(Date startTime) { | |||
| this.startTime = startTime; | |||
| } | |||
| public Date getEndTime() { | |||
| return endTime; | |||
| } | |||
| public void setEndTime(Date endTime) { | |||
| this.endTime = endTime; | |||
| } | |||
| public String getPhone() { | |||
| return phone; | |||
| } | |||
| public void setPhone(String phone) { | |||
| this.phone = phone; | |||
| } | |||
| } | |||
| package com.simple.domain.dto; | |||
| import java.io.Serializable; | |||
| import java.util.Date; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Transient; | |||
| /** | |||
| * 用户查询dto | |||
| * @author jinguo | |||
| * | |||
| */ | |||
| public class WxCUserBasicInfoDto implements Serializable{ | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = -1116465873573690766L; | |||
| @Id | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="开始时间",name="startTime") | |||
| private Date startTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="结束时间",name="endTime") | |||
| private Date endTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="手机号",name="phone") | |||
| private String phone; | |||
| @io.swagger.annotations.ApiModelProperty(value="姓名",name="name") | |||
| private String name; | |||
| /*租户id**/ | |||
| // @io.swagger.annotations.ApiModelProperty(value="租户id",name="tenantId") | |||
| @Transient | |||
| private String tenantId; | |||
| @Transient | |||
| private Date birthStartTime; | |||
| @Transient | |||
| private Date birthEndTime; | |||
| @Transient | |||
| private Integer sex; | |||
| public Long getId() { | |||
| return id; | |||
| } | |||
| public void setId(Long id) { | |||
| this.id = id; | |||
| } | |||
| public Date getBirthStartTime() { | |||
| return birthStartTime; | |||
| } | |||
| public void setBirthStartTime(Date birthStartTime) { | |||
| this.birthStartTime = birthStartTime; | |||
| } | |||
| public Date getBirthEndTime() { | |||
| return birthEndTime; | |||
| } | |||
| public void setBirthEndTime(Date birthEndTime) { | |||
| this.birthEndTime = birthEndTime; | |||
| } | |||
| public Integer getSex() { | |||
| return sex; | |||
| } | |||
| public void setSex(Integer sex) { | |||
| this.sex = sex; | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| public void setName(String name) { | |||
| this.name = name; | |||
| } | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String tenantId) { | |||
| this.tenantId = tenantId; | |||
| } | |||
| public Date getStartTime() { | |||
| return startTime; | |||
| } | |||
| public void setStartTime(Date startTime) { | |||
| this.startTime = startTime; | |||
| } | |||
| public Date getEndTime() { | |||
| return endTime; | |||
| } | |||
| public void setEndTime(Date endTime) { | |||
| this.endTime = endTime; | |||
| } | |||
| public String getPhone() { | |||
| return phone; | |||
| } | |||
| public void setPhone(String phone) { | |||
| this.phone = phone; | |||
| } | |||
| } | |||
| @@ -0,0 +1,275 @@ | |||
| package com.simple.domain.po; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| import javax.persistence.Transient; | |||
| import java.io.Serializable; | |||
| import java.math.BigDecimal; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @Table(name = "wx_bill_rent") | |||
| public class WxBillRent 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; | |||
| } | |||
| @Transient | |||
| protected WxMerchant wxMerchant; | |||
| @Transient | |||
| protected WxShop wxShop; | |||
| /*商铺ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商铺ID",name="shopId") | |||
| private Integer shopId; | |||
| /*使用面积**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="使用面积",name="userArea") | |||
| private BigDecimal userArea; | |||
| /*单价**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="单价",name="price") | |||
| private BigDecimal price; | |||
| /*应缴金额**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="应收金额",name="needPay") | |||
| private BigDecimal needPay; | |||
| /*应收金额**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="实际应收金额",name="receivePay") | |||
| private BigDecimal receivePay; | |||
| /*实收金额**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="实缴金额",name="pay") | |||
| private BigDecimal pay; | |||
| /*缴费周期**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="缴费周期",name="receivePeriod") | |||
| private Integer receivePeriod; | |||
| /*收款日期**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="收款日期",name="receiveDate") | |||
| private Date receiveDate; | |||
| /*到账日期**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="到账日期",name="payDate") | |||
| private Date payDate; | |||
| /*创建时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createtime") | |||
| private Date createtime; | |||
| /*逾期天数**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="逾期天数",name="expiredDay") | |||
| private Integer expiredDay; | |||
| /*付款方式:1微信2支付宝3银行4现金**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="付款方式:1微信2支付宝3银行4现金",name="payWay") | |||
| private Integer payWay; | |||
| /*单据编号**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="单据编号",name="receiptNum") | |||
| private String receiptNum; | |||
| /*租户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| /*欠缴**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="欠缴金额",name="owe") | |||
| private BigDecimal owe; | |||
| public Integer getShopId() { | |||
| return shopId; | |||
| } | |||
| public void setShopId(Integer _shopId) { | |||
| shopId = _shopId; | |||
| } | |||
| public BigDecimal getUserArea() { | |||
| return userArea; | |||
| } | |||
| public void setUserArea(BigDecimal _userArea) { | |||
| userArea = _userArea; | |||
| } | |||
| public BigDecimal getPrice() { | |||
| return price; | |||
| } | |||
| public void setPrice(BigDecimal _price) { | |||
| price = _price; | |||
| } | |||
| public BigDecimal getNeedPay() { | |||
| return needPay; | |||
| } | |||
| public void setNeedPay(BigDecimal _needPay) { | |||
| needPay = _needPay; | |||
| } | |||
| public BigDecimal getReceivePay() { | |||
| return receivePay; | |||
| } | |||
| public void setReceivePay(BigDecimal _receivePay) { | |||
| receivePay = _receivePay; | |||
| } | |||
| public BigDecimal getPay() { | |||
| return pay; | |||
| } | |||
| public void setPay(BigDecimal _pay) { | |||
| pay = _pay; | |||
| } | |||
| public Integer getReceivePeriod() { | |||
| return receivePeriod; | |||
| } | |||
| public void setReceivePeriod(Integer _receivePeriod) { | |||
| receivePeriod = _receivePeriod; | |||
| } | |||
| public Date getReceiveDate() { | |||
| return receiveDate; | |||
| } | |||
| public void setReceiveDate(Date _receiveDate) { | |||
| receiveDate = _receiveDate; | |||
| } | |||
| public Date getPayDate() { | |||
| return payDate; | |||
| } | |||
| public void setPayDate(Date _payDate) { | |||
| payDate = _payDate; | |||
| } | |||
| public Date getCreatetime() { | |||
| return createtime; | |||
| } | |||
| public void setCreatetime(Date _createtime) { | |||
| createtime = _createtime; | |||
| } | |||
| public Integer getExpiredDay() { | |||
| return expiredDay; | |||
| } | |||
| public void setExpiredDay(Integer _expiredDay) { | |||
| expiredDay = _expiredDay; | |||
| } | |||
| public Integer getPayWay() { | |||
| return payWay; | |||
| } | |||
| public void setPayWay(Integer _payWay) { | |||
| payWay = _payWay; | |||
| } | |||
| public String getReceiptNum() { | |||
| return receiptNum; | |||
| } | |||
| public void setReceiptNum(String _receiptNum) { | |||
| receiptNum = _receiptNum; | |||
| } | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String tenantId) { | |||
| this.tenantId = tenantId; | |||
| } | |||
| public WxMerchant getWxMerchant() { | |||
| return wxMerchant; | |||
| } | |||
| public void setWxMerchant(WxMerchant wxMerchant) { | |||
| this.wxMerchant = wxMerchant; | |||
| } | |||
| public BigDecimal getOwe() { | |||
| return owe; | |||
| } | |||
| public void setOwe(BigDecimal owe) { | |||
| this.owe = owe; | |||
| } | |||
| public WxShop getWxShop() { | |||
| return wxShop; | |||
| } | |||
| public void setWxShop(WxShop wxShop) { | |||
| this.wxShop = wxShop; | |||
| } | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,ShopId_ASC("`shop_id` ASC"),ShopId_DESC("`shop_id` DESC") | |||
| ,UserArea_ASC("`userArea` ASC"),UserArea_DESC("`userArea` DESC") | |||
| ,Price_ASC("`price` ASC"),Price_DESC("`price` DESC") | |||
| ,NeedPay_ASC("`needPay` ASC"),NeedPay_DESC("`needPay` DESC") | |||
| ,ReceivePay_ASC("`receivePay` ASC"),ReceivePay_DESC("`receivePay` DESC") | |||
| ,Pay_ASC("`pay` ASC"),Pay_DESC("`pay` DESC") | |||
| ,ReceivePeriod_ASC("`receive_period` ASC"),ReceivePeriod_DESC("`receive_period` DESC") | |||
| ,ReceiveDate_ASC("`receiveDate` ASC"),ReceiveDate_DESC("`receiveDate` DESC") | |||
| ,PayDate_ASC("`payDate` ASC"),PayDate_DESC("`payDate` DESC") | |||
| ,Createtime_ASC("`createtime` ASC"),Createtime_DESC("`createtime` DESC") | |||
| ,ExpiredDay_ASC("`expiredDay` ASC"),ExpiredDay_DESC("`expiredDay` DESC") | |||
| ,PayWay_ASC("`payWay` ASC"),PayWay_DESC("`payWay` DESC") | |||
| ,ReceiptNum_ASC("`receiptNum` ASC"),ReceiptNum_DESC("`receiptNum` 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()); | |||
| } | |||
| this.sortColumns=sb.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)); | |||
| } | |||
| } | |||
| } | |||
| @@ -66,9 +66,6 @@ public class WxCUserBasicInfo implements Serializable { | |||
| /*标签**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="标签",name="tagId") | |||
| private Long tagId; | |||
| /*wx_c_user 的id**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="wx_c_user 的id",name="cUserId") | |||
| private Long cUserId; | |||
| /*创建时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| @@ -186,12 +183,6 @@ public class WxCUserBasicInfo implements Serializable { | |||
| public void setTagId(Long _tagId) { | |||
| tagId = _tagId; | |||
| } | |||
| public Long getCUserId() { | |||
| return cUserId; | |||
| } | |||
| public void setCUserId(Long _cUserId) { | |||
| cUserId = _cUserId; | |||
| } | |||
| public Date getCreateDate() { | |||
| return createDate; | |||
| } | |||
| @@ -230,8 +221,7 @@ public class WxCUserBasicInfo implements Serializable { | |||
| ,Email_ASC("`email` ASC"),Email_DESC("`email` DESC") | |||
| ,Address_ASC("`address` ASC"),Address_DESC("`address` DESC") | |||
| ,Poins_ASC("`poins` ASC"),Poins_DESC("`poins` DESC") | |||
| ,TagId_ASC("`tagId` ASC"),TagId_DESC("`tagId` DESC") | |||
| ,CUserId_ASC("`cUserId` ASC"),CUserId_DESC("`cUserId` DESC") | |||
| ,TagId_ASC("`tag_id` ASC"),TagId_DESC("`tag_id` DESC") | |||
| ,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC") | |||
| ,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC") | |||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||
| @@ -4,6 +4,7 @@ import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| import javax.persistence.Transient; | |||
| import java.io.Serializable; | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @@ -56,6 +57,10 @@ public class WxMerchant implements Serializable { | |||
| @Transient | |||
| private Date rentalEndDate; | |||
| /*单价**/ | |||
| @Transient | |||
| private BigDecimal price; | |||
| /*租户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @@ -202,6 +207,14 @@ public class WxMerchant implements Serializable { | |||
| this.linkPerson = linkPerson; | |||
| } | |||
| public BigDecimal getPrice() { | |||
| return price; | |||
| } | |||
| public void setPrice(BigDecimal price) { | |||
| this.price = price; | |||
| } | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| @@ -39,9 +39,11 @@ public class WxPayAccount implements Serializable { | |||
| public void setIds(List<Long> ids) { | |||
| this.ids = ids; | |||
| } | |||
| /*租户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| /**微信商户号/特约服务商号**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="微信商户号/特约服务商号",name="mchId") | |||
| private String mchId; | |||
| @@ -60,6 +62,20 @@ public class WxPayAccount implements Serializable { | |||
| /**商户模式**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商户模式-0:普通商户模式1:服务商模式",name="type") | |||
| private Integer type; | |||
| /**是否开启分账**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="0:未开启分账1:开启分账",name="type") | |||
| private boolean share; | |||
| /**手续费**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="手续费",name="rate") | |||
| private Integer rate; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String tenantId) { | |||
| this.tenantId = tenantId; | |||
| } | |||
| public String getMchId() { | |||
| return mchId; | |||
| @@ -94,14 +110,26 @@ public class WxPayAccount implements Serializable { | |||
| public void setCertPath(String _certPath) { | |||
| certPath = _certPath; | |||
| } | |||
| public Integer getType() { | |||
| return type; | |||
| } | |||
| public void setType(Integer type) { | |||
| this.type = type; | |||
| } | |||
| public boolean isShare() { | |||
| return share; | |||
| } | |||
| public void setShare(boolean share) { | |||
| this.share = share; | |||
| } | |||
| public Integer getRate() { | |||
| return rate; | |||
| } | |||
| public void setRate(Integer rate) { | |||
| this.rate = rate; | |||
| } | |||
| public String getPayNotifyUrl() { | |||
| return notifyUrl + "/pay"; | |||
| @@ -113,15 +141,19 @@ public class WxPayAccount implements Serializable { | |||
| return notifyUrl + "/separate"; | |||
| } | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||
| ,MchId_ASC("`mch_id` ASC"),MchId_DESC("`mch_id` DESC") | |||
| ,SubMchId_ASC("`sub_mch_id` ASC"),SubMchId_DESC("`sub_mch_id` DESC") | |||
| ,ApiKey_ASC("`api_key` ASC"),ApiKey_DESC("`api_key` DESC") | |||
| ,NotifyUrl_ASC("`notify_url` ASC"),NotifyUrl_DESC("`notify_url` DESC") | |||
| ,CertPath_ASC("`cert_path` ASC"),CertPath_DESC("`cert_path` DESC") | |||
| ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | |||
| ,Share_ASC("`share` ASC"),Share_DESC("`share` DESC") | |||
| ,Rate_ASC("`rate` ASC"),Rate_DESC("`rate` DESC") | |||
| ; | |||
| private String value; | |||
| Field(String value){ | |||
| @@ -42,49 +42,55 @@ public class WxPayOrder implements Serializable { | |||
| /*租户ID**/ | |||
| /**租户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| /*创建时间**/ | |||
| /**创建时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime") | |||
| private Date createTime; | |||
| /*更新时间**/ | |||
| /**更新时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateTime") | |||
| private Date updateTime; | |||
| /*订单ID**/ | |||
| /**订单ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="订单ID",name="orderId") | |||
| private Long orderId; | |||
| /*用户ID**/ | |||
| /**用户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="用户ID",name="cUserId") | |||
| private Long cUserId; | |||
| /*ip地址**/ | |||
| /**ip地址**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="ip地址",name="ip") | |||
| private String ip; | |||
| /*支付金额(分)**/ | |||
| /**支付金额(分)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="支付金额(分)",name="payAmount") | |||
| private Integer payAmount; | |||
| /*支付发起时间**/ | |||
| /**支付发起时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="支付发起时间",name="payTimeStart") | |||
| private Date payTimeStart; | |||
| /*支付结束时间**/ | |||
| /**支付结束时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="支付结束时间",name="payTimeEnd") | |||
| private Date payTimeEnd; | |||
| /*微信预支付交易会话标识**/ | |||
| /**微信预支付交易会话标识**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="微信预支付交易会话标识",name="prepayId") | |||
| private String prepayId; | |||
| /*微信生成的订单号**/ | |||
| /**微信生成的订单号**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="微信生成的订单号",name="transactionId") | |||
| private String transactionId; | |||
| /*支付渠道: 0-微信 1-支付宝 2-银联 **/ | |||
| /**支付渠道: 0-微信 1-支付宝 2-银联 **/ | |||
| @io.swagger.annotations.ApiModelProperty(value="支付渠道: 0-微信 1-支付宝 2-银联 ",name="payVendor") | |||
| private Integer payVendor; | |||
| /*支付订单号**/ | |||
| /**支付订单号**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="支付订单号",name="payOrderNo") | |||
| private String payOrderNo; | |||
| /*支付状态: 0-支付中;1-支付成功;2-支付失败**/ | |||
| /**支付状态: 0-支付中;1-支付成功;2-支付失败**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="支付状态: 0-支付中;1-支付成功;2-支付失败",name="payOrderStatus") | |||
| private Integer payOrderStatus; | |||
| /*支付失败原因**/ | |||
| /**分账状态: 0-未分账;1-分账**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="分账状态: 0-未分账;1-分账",name="payOrderStatus") | |||
| private Integer share; | |||
| /**分账金额(总金额扣除手续费后的金额)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="分账金额",name="shareAmount") | |||
| private Integer shareAmount; | |||
| /**支付失败原因**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="支付失败原因",name="failReason") | |||
| private String failReason; | |||
| public String getTenantId() { | |||
| @@ -111,12 +117,15 @@ public class WxPayOrder implements Serializable { | |||
| public void setOrderId(Long _orderId) { | |||
| orderId = _orderId; | |||
| } | |||
| public Long getCUserId() { | |||
| public Long getcUserId() { | |||
| return cUserId; | |||
| } | |||
| public void setCUserId(Long _cUserId) { | |||
| cUserId = _cUserId; | |||
| public void setcUserId(Long cUserId) { | |||
| this.cUserId = cUserId; | |||
| } | |||
| public String getIp() { | |||
| return ip; | |||
| } | |||
| @@ -174,6 +183,22 @@ public class WxPayOrder implements Serializable { | |||
| public void setPayOrderStatus(Integer _payOrderStatus) { | |||
| payOrderStatus = _payOrderStatus; | |||
| } | |||
| public Integer getShare() { | |||
| return share; | |||
| } | |||
| public void setShare(Integer share) { | |||
| this.share = share; | |||
| } | |||
| public Integer getShareAmount() { | |||
| return shareAmount; | |||
| } | |||
| public void setShareAmount(Integer shareAmount) { | |||
| this.shareAmount = shareAmount; | |||
| } | |||
| public String getFailReason() { | |||
| return failReason; | |||
| } | |||
| @@ -200,6 +225,8 @@ public class WxPayOrder implements Serializable { | |||
| ,PayVendor_ASC("`pay_vendor` ASC"),PayVendor_DESC("`pay_vendor` DESC") | |||
| ,PayOrderNo_ASC("`pay_order_no` ASC"),PayOrderNo_DESC("`pay_order_no` DESC") | |||
| ,PayOrderStatus_ASC("`pay_order_status` ASC"),PayOrderStatus_DESC("`pay_order_status` DESC") | |||
| ,Share_ASC("`share` ASC"),Share_DESC("`share` DESC") | |||
| ,ShareAmount_ASC("`share_amount` ASC"),ShareAmount_DESC("`share_amount` DESC") | |||
| ,FailReason_ASC("`fail_reason` ASC"),FailReason_DESC("`fail_reason` DESC") | |||
| ; | |||
| private String value; | |||
| @@ -235,7 +262,6 @@ public class WxPayOrder implements Serializable { | |||
| } | |||
| this.sortColumns = sb.toString(); | |||
| } | |||
| public void setSortColumns(String sortColumns) | |||
| @@ -0,0 +1,170 @@ | |||
| package com.simple.domain.po; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| import javax.persistence.Transient; | |||
| import java.io.Serializable; | |||
| import java.math.BigDecimal; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @Table(name = "wx_rent_contract") | |||
| public class WxRentContract 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="merchantId") | |||
| private Long merchantId; | |||
| /*单价**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="单价",name="price") | |||
| private BigDecimal price; | |||
| /*计租开始时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="计租开始时间",name="rentalStartDate") | |||
| private Date rentalStartDate; | |||
| /*计租结束时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="计租结束时间",name="rentalEndDate") | |||
| private Date rentalEndDate; | |||
| /*签定合同时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="签定合同时间",name="signDate") | |||
| private Date signDate; | |||
| /*计租面积**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="计租面积",name="payArea") | |||
| private BigDecimal payArea; | |||
| /***/ | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="receivePeriod") | |||
| private Integer receivePeriod; | |||
| public Long getMerchantId() { | |||
| return merchantId; | |||
| } | |||
| public void setMerchantId(Long _merchantId) { | |||
| merchantId = _merchantId; | |||
| } | |||
| public BigDecimal getPrice() { | |||
| return price; | |||
| } | |||
| public void setPrice(BigDecimal _price) { | |||
| price = _price; | |||
| } | |||
| public Date getRentalStartDate() { | |||
| return rentalStartDate; | |||
| } | |||
| public void setRentalStartDate(Date _rentalStartDate) { | |||
| rentalStartDate = _rentalStartDate; | |||
| } | |||
| public Date getRentalEndDate() { | |||
| return rentalEndDate; | |||
| } | |||
| public void setRentalEndDate(Date _rentalEndDate) { | |||
| rentalEndDate = _rentalEndDate; | |||
| } | |||
| public Date getSignDate() { | |||
| return signDate; | |||
| } | |||
| public void setSignDate(Date _signDate) { | |||
| signDate = _signDate; | |||
| } | |||
| public BigDecimal getPayArea() { | |||
| return payArea; | |||
| } | |||
| public void setPayArea(BigDecimal _payArea) { | |||
| payArea = _payArea; | |||
| } | |||
| public Integer getReceivePeriod() { | |||
| return receivePeriod; | |||
| } | |||
| public void setReceivePeriod(Integer _receivePeriod) { | |||
| receivePeriod = _receivePeriod; | |||
| } | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,MerchantId_ASC("`merchantId` ASC"),MerchantId_DESC("`merchantId` DESC") | |||
| ,Price_ASC("`price` ASC"),Price_DESC("`price` DESC") | |||
| ,RentalStartDate_ASC("`rentalStartDate` ASC"),RentalStartDate_DESC("`rentalStartDate` DESC") | |||
| ,RentalEndDate_ASC("`rentalEndDate` ASC"),RentalEndDate_DESC("`rentalEndDate` DESC") | |||
| ,SignDate_ASC("`signDate` ASC"),SignDate_DESC("`signDate` DESC") | |||
| ,PayArea_ASC("`payArea` ASC"),PayArea_DESC("`payArea` DESC") | |||
| ,ReceivePay_ASC("`receive_period` ASC"),ReceivePay_DESC("`receive_period` 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)); | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,58 @@ | |||
| package com.simple.domain.vo; | |||
| import com.simple.domain.po.WxCoupon; | |||
| import java.io.Serializable; | |||
| import java.util.Date; | |||
| /** | |||
| * Created by syf on 2018/9/6. | |||
| * 返回投放错误列表使用 | |||
| */ | |||
| public class WxCouponChannelAddVo implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| private Long couponId; | |||
| private String title; | |||
| private Integer channelId; | |||
| private Date validEndDate; | |||
| public WxCouponChannelAddVo toCouponChannnelVo(WxCoupon wxCoupon,Integer channelId){ | |||
| this.couponId = wxCoupon.getId(); | |||
| this.title = wxCoupon.getTitle(); | |||
| this.validEndDate = wxCoupon.getValidEndDate(); | |||
| return this; | |||
| } | |||
| public Long getCouponId() { | |||
| return couponId; | |||
| } | |||
| public void setCouponId(Long couponId) { | |||
| this.couponId = couponId; | |||
| } | |||
| public String getTitle() { | |||
| return title; | |||
| } | |||
| public void setTitle(String title) { | |||
| this.title = title; | |||
| } | |||
| public Integer getChannelId() { | |||
| return channelId; | |||
| } | |||
| public void setChannelId(Integer channelId) { | |||
| this.channelId = channelId; | |||
| } | |||
| public Date getValidEndDate() { | |||
| return validEndDate; | |||
| } | |||
| public void setValidEndDate(Date validEndDate) { | |||
| this.validEndDate = validEndDate; | |||
| } | |||
| } | |||
| @@ -0,0 +1,38 @@ | |||
| package com.simple.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumPayShare { | |||
| // 0-未启用分账, 1-启用分账 | |||
| NO(0, "未启用分账"), | |||
| YES(1, "启用分账") | |||
| ; | |||
| public static EnumPayShare getEnum(Integer code) { | |||
| for (EnumPayShare value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumPayShare(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,39 @@ | |||
| package com.simple.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumProfitSharingResultStatus { | |||
| PROFIT_SHARING_UNKNOWN(-1, "未知"), | |||
| PROFIT_SHARING_RESULT_PENDING(1, "待分账"), | |||
| PROFIT_SHARING_RESULT_SUCCESS(2, "分账成功"), | |||
| PROFIT_SHARING_RESULT_ADJUST(3, "分账失败待调账"), | |||
| PROFIT_SHARING_RESULT_RETURNED(4, "已转回分账方"), | |||
| PROFIT_SHARING_RESULT_CLOSED(5, "已关闭"), | |||
| ; | |||
| public static EnumProfitSharingResultStatus getEnum(Integer code) { | |||
| for (EnumProfitSharingResultStatus value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumProfitSharingResultStatus(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,17 @@ | |||
| package com.simple.mapper; | |||
| import com.simple.common.CommonMapper; | |||
| import com.simple.domain.po.WxBillRent; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| public interface WxBillRentMapper extends CommonMapper<WxBillRent, String> { | |||
| List<WxBillRent> findList(WxBillRent wxBillRent); | |||
| List<Map<String,Object>> findListMap(WxBillRent record); | |||
| Map<String,Object> queryPayInfo(Map<String,Object> params); | |||
| } | |||
| @@ -2,9 +2,8 @@ package com.simple.mapper; | |||
| import java.util.*; | |||
| import com.simple.common.CommonMapper; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import com.simple.domain.dto.WxCuerBasicInfoDto; | |||
| import com.simple.domain.dto.WxCUserBasicInfoDto; | |||
| import com.simple.domain.po.WxCUserBasicInfo; | |||
| public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, String> { | |||
| @@ -13,11 +12,11 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S | |||
| List<WxCUserBasicInfo> list(WxCuerBasicInfoDto record); | |||
| List<WxCUserBasicInfo> list(WxCUserBasicInfoDto record); | |||
| void updateScore(WxCUserBasicInfo record); | |||
| long findCountBySex(WxCuerBasicInfoDto dto); | |||
| long findCountBySex(WxCUserBasicInfoDto dto); | |||
| long findCountByAge(WxCuerBasicInfoDto dto); | |||
| long findCountByAge(WxCUserBasicInfoDto dto); | |||
| } | |||
| @@ -5,7 +5,7 @@ import java.util.List; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import com.simple.common.CommonMapper; | |||
| import com.simple.domain.dto.WxCuerBasicInfoDto; | |||
| import com.simple.domain.dto.WxCUserBasicInfoDto; | |||
| import com.simple.domain.po.WxCUser; | |||
| public interface WxCUserMapper extends CommonMapper<WxCUser, Long> { | |||
| @@ -17,7 +17,7 @@ public interface WxCUserMapper extends CommonMapper<WxCUser, Long> { | |||
| WxCUser findByToken(String token); | |||
| long findCount(WxCuerBasicInfoDto dto); | |||
| long findCount(WxCUserBasicInfoDto dto); | |||
| List<WxCUser> listByChannel(@Param("sceneList")List<String> sceneList); | |||
| @@ -0,0 +1,15 @@ | |||
| package com.simple.mapper; | |||
| import com.simple.common.CommonMapper; | |||
| import com.simple.domain.po.WxRentContract; | |||
| import java.util.List; | |||
| public interface WxRentContractMapper extends CommonMapper<WxRentContract, String> { | |||
| List<WxRentContract> findList(WxRentContract wxRentContract); | |||
| WxRentContract findObjectByMerchantId(Long id); | |||
| } | |||
| @@ -13,4 +13,8 @@ public interface WxShopMapper extends CommonMapper<WxShop, String> { | |||
| List<Map<String,Object>> findListMap(WxShop record); | |||
| List<Map<String, Object>> getbshoplist(Map<String, Object> tenantId); | |||
| Map<String, Object> getMerchantShopByShopId(Map<String,Object> params); | |||
| } | |||
| @@ -134,7 +134,7 @@ public class WxPayOrderP { | |||
| @Override | |||
| public String toString() { | |||
| final StringBuilder sb = new StringBuilder("WxPayOrder{"); | |||
| final StringBuilder sb = new StringBuilder("WxPayOrderP{"); | |||
| sb.append("appid='").append(appid).append('\''); | |||
| sb.append(", mch_id='").append(mch_id).append('\''); | |||
| sb.append(", nonce_str='").append(nonce_str).append('\''); | |||
| @@ -53,7 +53,7 @@ public class WxPayOrderQ { | |||
| @Override | |||
| public String toString() { | |||
| final StringBuilder sb = new StringBuilder("WxPayOrder{"); | |||
| final StringBuilder sb = new StringBuilder("WxPayOrderQ{"); | |||
| sb.append("appid='").append(appid).append('\''); | |||
| sb.append(", mch_id='").append(mch_id).append('\''); | |||
| sb.append(", nonce_str='").append(nonce_str).append('\''); | |||
| @@ -11,6 +11,7 @@ public class WxPayOrderSP { | |||
| private String sub_mch_id; // 特约商户号 | |||
| private String nonce_str; // 随机字符串 | |||
| private String sign; // 签名 | |||
| private String sign_type; // 签名类型 | |||
| private String body; // 商品简单描述 128 | |||
| private String out_trade_no; // 商户订单号 | |||
| private Integer total_fee; // 支付金额 | |||
| @@ -21,6 +22,7 @@ public class WxPayOrderSP { | |||
| private String time_start; // 开始时间 | |||
| private String time_expire; // 失效时间 | |||
| private String sub_openid; // sub_openId | |||
| private String profit_sharing; // 是否开启分账 | |||
| public String getTime_start() { | |||
| return time_start; | |||
| @@ -86,6 +88,14 @@ public class WxPayOrderSP { | |||
| this.sign = sign; | |||
| } | |||
| public String getSign_type() { | |||
| return sign_type; | |||
| } | |||
| public void setSign_type(String sign_type) { | |||
| this.sign_type = sign_type; | |||
| } | |||
| public String getBody() { | |||
| return body; | |||
| } | |||
| @@ -150,11 +160,19 @@ public class WxPayOrderSP { | |||
| this.sub_openid = sub_openid; | |||
| } | |||
| public String getProfit_sharing() { | |||
| return profit_sharing; | |||
| } | |||
| public void setProfit_sharing(String profit_sharing) { | |||
| this.profit_sharing = profit_sharing; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| final StringBuilder sb = new StringBuilder("WxPayOrder{"); | |||
| final StringBuilder sb = new StringBuilder("WxPayOrderSP{"); | |||
| sb.append("appid='").append(appid).append('\''); | |||
| sb.append("sub_appid='").append(sub_appid).append('\''); | |||
| sb.append(", sub_appid='").append(sub_appid).append('\''); | |||
| sb.append(", mch_id='").append(mch_id).append('\''); | |||
| sb.append(", sub_mch_id='").append(sub_mch_id).append('\''); | |||
| sb.append(", nonce_str='").append(nonce_str).append('\''); | |||
| @@ -169,6 +187,7 @@ public class WxPayOrderSP { | |||
| sb.append(", time_start='").append(time_start).append('\''); | |||
| sb.append(", time_expire='").append(time_expire).append('\''); | |||
| sb.append(", sub_openid='").append(sub_openid).append('\''); | |||
| sb.append(", profit_sharing='").append(profit_sharing).append('\''); | |||
| sb.append('}'); | |||
| return sb.toString(); | |||
| } | |||
| @@ -10,6 +10,7 @@ public class WxPayOrderSQ { | |||
| private String sub_mch_id; // 特约商户号 | |||
| private String nonce_str; // 随机字符串 | |||
| private String sign; // 签名 | |||
| private String sign_type; // 签名类型 | |||
| private String out_trade_no; // 商户订单号 | |||
| @@ -61,6 +62,14 @@ public class WxPayOrderSQ { | |||
| this.sign = sign; | |||
| } | |||
| public String getSign_type() { | |||
| return sign_type; | |||
| } | |||
| public void setSign_type(String sign_type) { | |||
| this.sign_type = sign_type; | |||
| } | |||
| public String getOut_trade_no() { | |||
| return out_trade_no; | |||
| } | |||
| @@ -71,9 +80,9 @@ public class WxPayOrderSQ { | |||
| @Override | |||
| public String toString() { | |||
| final StringBuilder sb = new StringBuilder("WxPayOrder{"); | |||
| final StringBuilder sb = new StringBuilder("WxPayOrderSQ{"); | |||
| sb.append("appid='").append(appid).append('\''); | |||
| sb.append("sub_appid='").append(sub_appid).append('\''); | |||
| sb.append(", sub_appid='").append(sub_appid).append('\''); | |||
| sb.append(", mch_id='").append(mch_id).append('\''); | |||
| sb.append(", sub_mch_id='").append(sub_mch_id).append('\''); | |||
| sb.append(", nonce_str='").append(nonce_str).append('\''); | |||
| @@ -1,6 +1,7 @@ | |||
| package com.simple.pay; | |||
| import com.simple.utils.*; | |||
| import org.apache.commons.codec.digest.HmacUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import java.io.UnsupportedEncodingException; | |||
| @@ -168,7 +169,7 @@ public class WxPayment { | |||
| sighMap.put("appId", appId); | |||
| sighMap.put("timeStamp", timestamp); | |||
| sighMap.put("package", "prepay_id="+prepay_id); | |||
| sighMap.put("signType", "MD5"); | |||
| //sighMap.put("signType", "MD5"); | |||
| return buildSignAfterParasMap(params, paternerKey); | |||
| } | |||
| @@ -401,6 +402,23 @@ public class WxPayment { | |||
| return HashUtil.md5(stringSignTemp).toUpperCase(); | |||
| } | |||
| /** | |||
| * 生成签名 | |||
| * | |||
| * @param params | |||
| * 参数 | |||
| * @param partnerKey | |||
| * 支付密钥 | |||
| * @return sign | |||
| */ | |||
| public static String createSignHMAC(Map<String, String> params, String partnerKey) { | |||
| // 生成签名前先去除sign | |||
| params.remove("sign"); | |||
| String stringA = packageSign(params, false); | |||
| String stringSignTemp = stringA + "&key=" + partnerKey; | |||
| return HmacUtils.hmacSha256Hex(partnerKey, stringSignTemp).toUpperCase(); | |||
| } | |||
| /** | |||
| * 支付异步通知时校验sign | |||
| * | |||
| @@ -416,6 +434,21 @@ public class WxPayment { | |||
| return sign.equals(localSign); | |||
| } | |||
| /** | |||
| * 支付异步通知时校验sign | |||
| * | |||
| * @param params | |||
| * 参数 | |||
| * @param paternerKey | |||
| * 支付密钥 | |||
| * @return {boolean} | |||
| */ | |||
| public static boolean verifyNotifyHMAC(Map<String, String> params, String paternerKey) { | |||
| String sign = params.get("sign"); | |||
| String localSign = WxPayment.createSignHMAC(params, paternerKey); | |||
| return sign.equals(localSign); | |||
| } | |||
| /** | |||
| * 判断接口返回的code是否是SUCCESS | |||
| * | |||
| @@ -28,8 +28,8 @@ public class WxProfitSharing { | |||
| * @param params | |||
| * @return | |||
| */ | |||
| public static String pushOrder(Map<String, String> params) { | |||
| return doPost(PROFIT_SHARING_URL, params); | |||
| public static String pushOrder(Map<String, String> params, String certPath, String certPass) { | |||
| return doPostSSL(PROFIT_SHARING_URL, params, certPath, certPass); | |||
| } | |||
| /** | |||
| @@ -59,4 +59,8 @@ public class WxProfitSharing { | |||
| public static String doPost(String url, Map<String, String> params) { | |||
| return HttpUtil.payPost(url, WxPayment.toXml(params)); | |||
| } | |||
| public static String doPostSSL(String url, Map<String, String> params, String certPath, String certPass) { | |||
| return HttpUtil.payPostSSL(url, WxPayment.toXml(params), certPath, certPass); | |||
| } | |||
| } | |||
| @@ -14,8 +14,9 @@ public class WxProfitSharingP implements Serializable { | |||
| private String sub_appid; // 子公众账号ID | |||
| private String nonce_str; // 随机字符串 | |||
| private String sign; // 签名 | |||
| private String sign_type; // 签名方法 | |||
| private String transaction_id ; // 支付订单号 | |||
| private String out_trade_no; // 商户订单号 | |||
| private String out_order_no; // 商户订单号 | |||
| private String receivers; // 分账接收方 | |||
| public String getMch_id() { | |||
| @@ -64,6 +65,13 @@ public class WxProfitSharingP implements Serializable { | |||
| this.sign = sign; | |||
| } | |||
| public String getSign_type() { | |||
| return sign_type; | |||
| } | |||
| public void setSign_type(String sign_type) { | |||
| this.sign_type = sign_type; | |||
| } | |||
| public String getTransaction_id() { | |||
| return transaction_id; | |||
| } | |||
| @@ -72,10 +80,10 @@ public class WxProfitSharingP implements Serializable { | |||
| this.transaction_id = transaction_id; | |||
| } | |||
| public String getOut_trade_no() { return out_trade_no; } | |||
| public String getOut_order_no() { return out_order_no; } | |||
| public void setOut_trade_no(String out_trade_no) { | |||
| this.out_trade_no = out_trade_no; | |||
| public void setOut_order_no(String out_order_no) { | |||
| this.out_order_no = out_order_no; | |||
| } | |||
| public String getReceivers() { | |||
| @@ -86,4 +94,21 @@ public class WxProfitSharingP implements Serializable { | |||
| this.receivers = receivers; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| final StringBuilder sb = new StringBuilder("WxPayOrderSQ{"); | |||
| sb.append("appid='").append(appid).append('\''); | |||
| sb.append(", sub_appid='").append(sub_appid).append('\''); | |||
| sb.append(", mch_id='").append(mch_id).append('\''); | |||
| sb.append(", sub_mch_id='").append(sub_mch_id).append('\''); | |||
| sb.append(", nonce_str='").append(nonce_str).append('\''); | |||
| sb.append(", sign='").append(sign).append('\''); | |||
| sb.append(", sign_type='").append(sign_type).append('\''); | |||
| sb.append(", transaction_id='").append(transaction_id).append('\''); | |||
| sb.append(", out_order_no='").append(out_order_no).append('\''); | |||
| sb.append(", receivers='").append(receivers).append('\''); | |||
| sb.append('}'); | |||
| return sb.toString(); | |||
| } | |||
| } | |||
| @@ -12,6 +12,7 @@ public class WxProfitSharingQueryP implements Serializable { | |||
| private String sub_mch_id; // 子商户号 | |||
| private String nonce_str; // 随机字符串 | |||
| private String sign; // 签名 | |||
| private String sign_type; // 签名方法 | |||
| private String transaction_id ; // 支付订单号 | |||
| private String out_trade_no; // 商户分账单号 | |||
| @@ -45,6 +46,13 @@ public class WxProfitSharingQueryP implements Serializable { | |||
| public void setSign(String sign) { | |||
| this.sign = sign; | |||
| } | |||
| public String getSign_type() { | |||
| return sign_type; | |||
| } | |||
| public void setSign_type(String sign_type) { | |||
| this.sign_type = sign_type; | |||
| } | |||
| public String getTransaction_id() { | |||
| return transaction_id; | |||
| @@ -14,6 +14,7 @@ public class WxProfitSharingReceiverP implements Serializable { | |||
| private String sub_appid; // 子公众账号ID | |||
| private String nonce_str; // 随机字符串 | |||
| private String sign; // 签名 | |||
| private String sign_type; // 签名方法 | |||
| private String receiver; // 分账接收方 | |||
| public String getMch_id() { | |||
| @@ -62,6 +63,14 @@ public class WxProfitSharingReceiverP implements Serializable { | |||
| this.sign = sign; | |||
| } | |||
| public String getSign_type() { | |||
| return sign_type; | |||
| } | |||
| public void setSign_type(String sign_type) { | |||
| this.sign_type = sign_type; | |||
| } | |||
| public String getReceiver() { | |||
| return receiver; | |||
| } | |||
| @@ -10,6 +10,7 @@ public class WxRefundOrderSP { | |||
| private String sub_mch_id; // 特约商户号 | |||
| private String nonce_str; // 随机字符串 | |||
| private String sign; // 签名 | |||
| private String sign_type; // 签名类型 | |||
| private String transaction_id; // 微信订单号 | |||
| private String out_trade_no; // 商户订单号 | |||
| private String out_refund_no; // 商户退款单号 | |||
| @@ -66,6 +67,14 @@ public class WxRefundOrderSP { | |||
| this.sign = sign; | |||
| } | |||
| public String getSign_type() { | |||
| return sign_type; | |||
| } | |||
| public void setSign_type(String sign_type) { | |||
| this.sign_type = sign_type; | |||
| } | |||
| public String getTransaction_id() { | |||
| return transaction_id; | |||
| } | |||
| @@ -126,7 +135,9 @@ public class WxRefundOrderSP { | |||
| public String toString() { | |||
| final StringBuilder sb = new StringBuilder("WxRefundOrder{"); | |||
| sb.append("appid='").append(appid).append('\''); | |||
| sb.append(", sub_appid='").append(sub_appid).append('\''); | |||
| sb.append(", mch_id='").append(mch_id).append('\''); | |||
| sb.append(", sub_mch_id='").append(sub_mch_id).append('\''); | |||
| sb.append(", nonce_str='").append(nonce_str).append('\''); | |||
| sb.append(", sign='").append(sign).append('\''); | |||
| sb.append(", out_trade_no='").append(out_trade_no).append('\''); | |||
| @@ -0,0 +1,48 @@ | |||
| package com.simple.service; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.po.WxBillRent; | |||
| public interface WxBillRentService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param offset | |||
| * @param limit | |||
| * @param record | |||
| * @return | |||
| */ | |||
| PageInfo<Map<String, Object>> listAsPage(WxBillRent record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxBillRent getById(String id); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(WxBillRent record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(String id); | |||
| } | |||
| @@ -1,7 +1,7 @@ | |||
| package com.simple.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.dto.WxCuerBasicInfoDto; | |||
| import com.simple.domain.dto.WxCUserBasicInfoDto; | |||
| import com.simple.domain.po.WxCUserBasicInfo; | |||
| public interface WxCUserBasicInfoService { | |||
| @@ -40,7 +40,7 @@ public interface WxCUserBasicInfoService { | |||
| PageInfo<WxCUserBasicInfo> list(WxCuerBasicInfoDto record, Integer pageIndex, Integer pageSize); | |||
| PageInfo<WxCUserBasicInfo> list(WxCUserBasicInfoDto record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 修改会员积分 | |||
| @@ -53,14 +53,14 @@ public interface WxCUserBasicInfoService { | |||
| * @param sex | |||
| * @return | |||
| */ | |||
| long findCountBySex(WxCuerBasicInfoDto dto); | |||
| long findCountBySex(WxCUserBasicInfoDto dto); | |||
| /** | |||
| * 根据年龄查询数量 | |||
| * @param dto | |||
| * @return | |||
| */ | |||
| long findCountByAge(WxCuerBasicInfoDto dto); | |||
| long findCountByAge(WxCUserBasicInfoDto dto); | |||
| @@ -3,7 +3,7 @@ package com.simple.service; | |||
| import java.util.List; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.dto.WxCuerBasicInfoDto; | |||
| import com.simple.domain.dto.WxCUserBasicInfoDto; | |||
| import com.simple.domain.po.WxCUser; | |||
| public interface WxCUserService { | |||
| @@ -61,7 +61,7 @@ public interface WxCUserService { | |||
| * @param dto | |||
| * @return | |||
| */ | |||
| long findCount(WxCuerBasicInfoDto dto); | |||
| long findCount(WxCUserBasicInfoDto dto); | |||
| /** | |||
| @@ -3,6 +3,8 @@ package com.simple.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxCouponOrder; | |||
| import com.simple.domain.po.WxMerchantBUser; | |||
| import com.simple.domain.po.WxOrder; | |||
| import com.simple.domain.vo.CUserDateAmountVo; | |||
| import java.util.Date; | |||
| @@ -61,7 +63,20 @@ public interface WxCouponOrderService { | |||
| * @param couponOrderId | |||
| * @param bUserId 核销人(登录用户) | |||
| */ | |||
| ResultData verify(Long couponOrderId, Long bUserId); | |||
| WxCouponOrder verify(Long couponOrderId, Long bUserId); | |||
| /** | |||
| * 核销发券 | |||
| * @param couponOrder | |||
| * @param bUser | |||
| */ | |||
| void sendCouponAfterVerify(WxCouponOrder couponOrder, WxMerchantBUser bUser); | |||
| /** | |||
| * 核销分账 | |||
| * @param couponOrder | |||
| */ | |||
| void shareAfterVerify(WxCouponOrder couponOrder); | |||
| /** | |||
| * 根据日期 b用户查券list | |||
| @@ -18,7 +18,7 @@ public interface WxPayOrderService { | |||
| * @param payWay | |||
| * @return | |||
| */ | |||
| ResultData createPayOrder(boolean isReal, boolean isShare, WxAppinfo appInfo, WxCUser user, WxPayOrder record, EnumPayWay payWay); | |||
| ResultData createPayOrder(boolean isReal, WxAppinfo appInfo, WxCUser user, WxPayOrder record, EnumPayWay payWay); | |||
| /** | |||
| * 微信支付订单查询 | |||
| @@ -0,0 +1,48 @@ | |||
| package com.simple.service; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.po.WxRentContract; | |||
| public interface WxRentContractService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param offset | |||
| * @param limit | |||
| * @return | |||
| */ | |||
| PageInfo<WxRentContract> listAsPage(WxRentContract record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxRentContract getById(String id); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(WxRentContract record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(String id); | |||
| } | |||
| @@ -2,6 +2,7 @@ package com.simple.service; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxShop; | |||
| public interface WxShopService { | |||
| @@ -39,12 +40,10 @@ public interface WxShopService { | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| ResultData getbshoplist(String tenantId, String shopNumber); | |||
| ResultData getMerchantShopByShopId(String tenantId, String shopId); | |||
| } | |||
| @@ -13,6 +13,7 @@ import com.simple.utils.DateUtils; | |||
| import com.simple.utils.HashUtil; | |||
| import com.simple.utils.HttpUtil; | |||
| import org.apache.log4j.Logger; | |||
| import org.apache.poi.ss.usermodel.DateUtil; | |||
| import org.apache.shiro.codec.Base64; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| @@ -46,6 +47,9 @@ public class DataTowerServiceImpl implements DataTowerService { | |||
| @Autowired | |||
| WxMallMapper wxMallMapper; | |||
| @Autowired | |||
| WxBillRentMapper wxBillRentMapper; | |||
| @Override | |||
| @@ -78,6 +82,28 @@ public class DataTowerServiceImpl implements DataTowerService { | |||
| datamap.put("wczl", wczl+"%"); | |||
| } | |||
| //租金 | |||
| Map<String,Object> params=new HashMap<>(); | |||
| params.put("tenantId",tenantId); | |||
| Calendar calendar = Calendar.getInstance();//日历对象 | |||
| calendar.setTime(new Date());//设置当前日期 | |||
| calendar.add(Calendar.MONTH, -1);//月份减一 | |||
| params.put("receiveDate", DateUtils.date2String(calendar.getTime(),"yyyy-MM")); | |||
| Map<String,Object> payinfo=wxBillRentMapper.queryPayInfo(params); | |||
| if(payinfo!=null){ | |||
| BigDecimal receivepay = (BigDecimal) payinfo.get("receivepay"); | |||
| BigDecimal pay = (BigDecimal) payinfo.get("pay"); | |||
| BigDecimal divide = receivepay.divide(pay); | |||
| double zjcjl = divide.doubleValue()*100; | |||
| datamap.put("ysje",receivepay); | |||
| datamap.put("ssje",pay); | |||
| datamap.put("zjsjl",zjcjl+"%"); | |||
| }else{ | |||
| datamap.put("ysje",0); | |||
| datamap.put("ssje",0); | |||
| datamap.put("zjsjl",0); | |||
| } | |||
| //上报 | |||
| WxMerchant wxMerchant = new WxMerchant(); | |||
| wxMerchant.setTenantId(tenantId); | |||
| @@ -0,0 +1,57 @@ | |||
| package com.simple.service.impl; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.IdWorker; | |||
| import com.simple.domain.po.WxBillRent; | |||
| import com.simple.mapper.WxBillRentMapper; | |||
| import com.simple.service.WxBillRentService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| @Service | |||
| public class WxBillRentServiceImpl implements WxBillRentService { | |||
| @Autowired | |||
| WxBillRentMapper wxBillRentMapper; | |||
| @Override | |||
| public PageInfo<Map<String, Object>> listAsPage(WxBillRent record, Integer pageIndex, Integer pageSize) { | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<Map<String,Object>> shops = wxBillRentMapper.findListMap(record); | |||
| PageInfo<Map<String,Object>> pageInfo = new PageInfo<>(shops); | |||
| return pageInfo; | |||
| //return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillRentMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public WxBillRent getById(String id) { | |||
| return wxBillRentMapper.selectByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(WxBillRent record) { | |||
| if (record.getId() == null) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| wxBillRentMapper.insertSelective(record); | |||
| } else { | |||
| wxBillRentMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(String id) { | |||
| wxBillRentMapper.deleteByPrimaryKey(id); | |||
| } | |||
| } | |||
| @@ -6,7 +6,7 @@ import org.springframework.stereotype.Service; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.IdWorker; | |||
| import com.simple.domain.dto.WxCuerBasicInfoDto; | |||
| import com.simple.domain.dto.WxCUserBasicInfoDto; | |||
| import com.simple.domain.po.WxCUserBasicInfo; | |||
| import com.simple.mapper.WxCUserBasicInfoMapper; | |||
| import com.simple.service.WxCUserBasicInfoService; | |||
| @@ -26,7 +26,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| @Override | |||
| public PageInfo<WxCUserBasicInfo> list(WxCuerBasicInfoDto record, Integer pageIndex, Integer pageSize) { | |||
| public PageInfo<WxCUserBasicInfo> list(WxCUserBasicInfoDto record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserBasicInfoMapper.list(record)); | |||
| } | |||
| @@ -63,7 +63,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| @Override | |||
| public long findCountBySex(WxCuerBasicInfoDto dto) { | |||
| public long findCountBySex(WxCUserBasicInfoDto dto) { | |||
| return wxCUserBasicInfoMapper.findCountBySex(dto); | |||
| } | |||
| @@ -71,7 +71,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| @Override | |||
| public long findCountByAge(WxCuerBasicInfoDto dto) { | |||
| public long findCountByAge(WxCUserBasicInfoDto dto) { | |||
| return wxCUserBasicInfoMapper.findCountByAge(dto); | |||
| } | |||
| @@ -3,7 +3,7 @@ package com.simple.service.impl; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.dto.WxCuerBasicInfoDto; | |||
| import com.simple.domain.dto.WxCUserBasicInfoDto; | |||
| import com.simple.domain.po.WxCUser; | |||
| import com.simple.mapper.WxCUserMapper; | |||
| import com.simple.service.WxCUserService; | |||
| @@ -63,7 +63,7 @@ public class WxCUserServiceImpl implements WxCUserService { | |||
| } | |||
| @Override | |||
| public long findCount(WxCuerBasicInfoDto dto) { | |||
| public long findCount(WxCUserBasicInfoDto dto) { | |||
| return wxCUserMapper.findCount(dto); | |||
| } | |||
| @@ -10,6 +10,7 @@ import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxCoupon; | |||
| import com.simple.domain.po.WxCouponChannel; | |||
| import com.simple.domain.po.WxMerchant; | |||
| import com.simple.domain.vo.WxCouponChannelAddVo; | |||
| import com.simple.domain.vo.WxCouponChannelVo; | |||
| import com.simple.mapper.WxCouponChannelMapper; | |||
| import com.simple.mapper.WxMerchantMapper; | |||
| @@ -70,20 +71,21 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| @Override | |||
| public ResultData addBatch(String[] ids, String[] channelId, String tanantId, Date beginTime, Date endTime) { | |||
| boolean result = false; | |||
| List<WxCouponChannelAddVo> errorList = new ArrayList<>(); | |||
| for (String targetIdstr:channelId) { | |||
| Integer targetId = Integer.parseInt(targetIdstr); | |||
| for (String couponidstr:ids) { | |||
| Long couponid = Long.parseLong(couponidstr); | |||
| boolean addResult = addCuponChannel(couponid,targetId,tanantId,beginTime,endTime); | |||
| boolean addResult = addCuponChannel(couponid,targetId,tanantId,beginTime,endTime,errorList); | |||
| if(addResult){ | |||
| result = true; | |||
| } | |||
| } | |||
| } | |||
| if(result) { | |||
| return new ResultData(); | |||
| return new ResultData(errorList); | |||
| }else { | |||
| return new ResultData(Result.ERROR,"请检查券的有效期以及投放截止时间"); | |||
| return new ResultData(Result.ERROR,"请检查券的有效期以及投放截止时间",errorList); | |||
| } | |||
| @@ -95,10 +97,11 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| wxCouponChannel.setTenantId(tenantId); | |||
| wxCouponChannel.setStatus(status); | |||
| wxCouponChannel.setCouponId(couponId); | |||
| wxCouponChannelMapper.updateStatusByCouponId(wxCouponChannel); | |||
| } | |||
| public boolean addCuponChannel(Long couponid,Integer channelId,String tanantId,Date beginTime,Date endTime){ | |||
| public boolean addCuponChannel(Long couponid,Integer channelId,String tanantId,Date beginTime,Date endTime,List<WxCouponChannelAddVo> errorList){ | |||
| WxCouponChannel wxCouponChannelQuery = new WxCouponChannel(); | |||
| wxCouponChannelQuery.setTenantId(tanantId); | |||
| @@ -121,10 +124,21 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| return false; | |||
| } | |||
| if(wxCoupon.getValidEndDate()!=null&&wxCoupon.getValidEndDate().before(endTime)){ | |||
| logger.debug(wxCoupon.getId()+"发放时间不能晚于使用时间"); | |||
| return false; | |||
| if(channelId==1){ //列表默认投放结束时间为有效时间之后 | |||
| beginTime = new Date(); | |||
| endTime = wxCoupon.getValidEndDate(); | |||
| } | |||
| if(channelId==2){ | |||
| if(wxCoupon.getValidEndDate()!=null&&wxCoupon.getValidEndDate().before(endTime)){ | |||
| logger.debug(wxCoupon.getId()+"发放时间不能晚于使用时间"); | |||
| WxCouponChannelAddVo vo = new WxCouponChannelAddVo(); | |||
| errorList.add(vo.toCouponChannnelVo(wxCoupon,channelId)); | |||
| return false; | |||
| } | |||
| } | |||
| WxCouponChannel wxCouponChannel = new WxCouponChannel(); | |||
| wxCouponChannel.setEndTime(endTime); | |||
| wxCouponChannel.setStatus(0); | |||
| @@ -14,11 +14,11 @@ import com.simple.domain.vo.WxCouponOrderCVo; | |||
| import com.simple.domain.vo.WxCouponOrderCarCVo; | |||
| import com.simple.enums.EnumCouponOrderStatus; | |||
| import com.simple.enums.EnumCouponSendType; | |||
| import com.simple.enums.EnumPayShare; | |||
| import com.simple.enums.EnumPayStatus; | |||
| import com.simple.exception.MallinkException; | |||
| import com.simple.mapper.*; | |||
| import com.simple.service.WxCouponOrderService; | |||
| import com.simple.service.WxCouponSendService; | |||
| import com.simple.service.WxOrderService; | |||
| import com.simple.service.*; | |||
| import org.apache.log4j.Logger; | |||
| import org.apache.poi.ss.usermodel.Workbook; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -58,6 +58,13 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| @Autowired | |||
| WxCouponSendService wxCouponSendService; | |||
| @Autowired | |||
| WxProfitSharingOrderService wxProfitSharingOrderService; | |||
| @Autowired | |||
| WxPayOrderMapper wxPayOrderMapper; | |||
| @Override | |||
| public PageInfo<WxCouponOrder> listAsPage(WxCouponOrder record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findList(record)); | |||
| @@ -288,10 +295,9 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| } | |||
| } | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public ResultData verify(Long couponOrderId, Long bUserId) { | |||
| public WxCouponOrder verify(Long couponOrderId, Long bUserId) { | |||
| WxCouponOrder wxCouponOrder = wxCouponOrderMapper.selectByPrimaryKey(couponOrderId); | |||
| if(wxCouponOrder == null){ | |||
| @@ -311,48 +317,74 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| logger.error("券: couponMerchantId-" + wxOrder.getMerchantId()+"核销: couponMerchantId-"+wxMerchantBUser.getMerchantId()); | |||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); | |||
| } | |||
| if (wxCouponOrder.getCouponOrderStatus() == EnumCouponOrderStatus.COUPON_ORDER_OVER_TIME.getCode()) { | |||
| logger.error("已过期: couponOrder-" + couponOrderId); | |||
| logger.error("已过期: couponOrder-" + wxCouponOrder.getId()); | |||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_OVER_TIME); | |||
| } | |||
| if (wxCouponOrder.getCouponOrderStatus() == EnumCouponOrderStatus.COUPON_ORDER_INVALID.getCode()) { | |||
| logger.error("已退款: couponOrder-" + couponOrderId); | |||
| logger.error("已退款: couponOrder-" + wxCouponOrder.getId()); | |||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_INVALID); | |||
| } | |||
| if (wxCouponOrder.getCouponOrderStatus() == EnumCouponOrderStatus.COUPON_ORDER_USED.getCode()) { | |||
| logger.error("已经核销过的券: couponOrder-" + couponOrderId); | |||
| logger.error("已经核销过的券: couponOrder-" + wxCouponOrder.getId()); | |||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_USED); | |||
| } | |||
| try { | |||
| wxCouponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USED.getCode()); //1核销 | |||
| wxCouponOrder.setBUserId(bUserId); | |||
| wxCouponOrder.setBUserId(wxMerchantBUser.getBUserId()); | |||
| wxCouponOrder.setUpdateDate(new Date()); | |||
| wxCouponOrderMapper.updateByPrimaryKeySelective(wxCouponOrder); | |||
| } catch (Exception e) { | |||
| logger.error("db failed: couponOrder-" + couponOrderId + ", e:" + e.getMessage()); | |||
| logger.error("db failed: couponOrder-" + wxCouponOrder.getId() + ", e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| // 核销发券 | |||
| wxCouponSendService.sendCouponToUser(wxMerchantBUser.getTenantId(), wxOrder.getCUserId(), EnumCouponSendType.COUPON_VERIFY.getCode()); | |||
| return wxCouponOrder; | |||
| return new ResultData(wxCouponOrder); | |||
| } | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void shareAfterVerify(WxCouponOrder couponOrder) { | |||
| // 微信分账 | |||
| try { | |||
| WxPayOrder wxPayOrder = new WxPayOrder(); | |||
| wxPayOrder.setOrderId(couponOrder.getOrderId()); | |||
| wxPayOrder.setPayOrderStatus(EnumPayStatus.PAY_WAY_SUCCESS.getCode()); | |||
| wxPayOrder = wxPayOrderMapper.selectOne(wxPayOrder); | |||
| if (wxPayOrder == null) | |||
| throw new MallinkException(ErrorCode.PAY_ORDER_NOT_FOUND); | |||
| if (wxPayOrder.getShare() == EnumPayShare.YES.getCode()) | |||
| wxProfitSharingOrderService.createSharingOrder(wxPayOrder); | |||
| } catch (Exception e) { | |||
| logger.error("微信分账: " + e.getMessage()); | |||
| } | |||
| } | |||
| @Override | |||
| public void sendCouponAfterVerify(WxCouponOrder couponOrder, WxMerchantBUser bUser) { | |||
| // 核销发券 | |||
| WxOrder wxOrder = wxOrderMapper.selectByPrimaryKey(couponOrder.getOrderId()); | |||
| if (wxOrder != null) { | |||
| try { | |||
| wxCouponSendService.sendCouponToUser(bUser.getTenantId(), wxOrder.getCUserId(), EnumCouponSendType.COUPON_VERIFY.getCode()); | |||
| } catch (Exception e) { | |||
| logger.error("核销发券: " + e.getMessage()); | |||
| } | |||
| } | |||
| } | |||
| @Override | |||
| public List<CUserDateAmountVo> queryPriceTotalGroup(String tenantId, Date startTime, Date endTime) { | |||
| return wxCouponOrderMapper.queryPriceTotalGroup(tenantId, startTime, endTime); | |||
| } | |||
| @Override | |||
| public int queryPriceTotal(String tenantId, Date startTime, Date endTime) { | |||
| return wxCouponOrderMapper.queryPriceTotal(tenantId, startTime, endTime); | |||
| } | |||
| } | |||
| @@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import java.math.BigDecimal; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @@ -36,6 +37,9 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| @Autowired | |||
| WxAppinfoMapper wxAppinfoMapper; | |||
| @Autowired | |||
| WxRentContractMapper wxRentContractMapper; | |||
| @Override | |||
| public PageInfo<WxMerchant> listAsPage(WxMerchant record, Integer pageIndex, Integer pageSize) { | |||
| @@ -123,6 +127,16 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| wxMerchant.setCreateDate(date); | |||
| wxMerchantMapper.insertSelective(wxMerchant); | |||
| WxRentContract wxRentContract = new WxRentContract(); | |||
| wxRentContract.setMerchantId(merchantid); | |||
| wxRentContract.setRentalStartDate(wxMerchant.getRentalStartDate()); | |||
| wxRentContract.setRentalEndDate(wxMerchant.getRentalEndDate()); | |||
| wxRentContract.setPrice(wxMerchant.getPrice()); | |||
| wxRentContract.setSignDate(date); | |||
| wxRentContract.setPayArea(new BigDecimal(0)); | |||
| wxRentContract.setReceivePeriod(0); | |||
| wxRentContractMapper.insertSelective(wxRentContract); | |||
| //保存商户商铺的关联 | |||
| List<Long> shopidlist = wxMerchant.getShopids(); | |||
| for(Long shopid:shopidlist){ | |||
| @@ -171,6 +185,15 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| wxMerchant.setUpdateDate(date); | |||
| wxMerchantMapper.updateByPrimaryKeySelective(wxMerchant); | |||
| WxRentContract wxRentContract = wxRentContractMapper.findObjectByMerchantId(wxMerchant.getId()); | |||
| wxRentContract.setRentalStartDate(wxMerchant.getRentalStartDate()); | |||
| wxRentContract.setRentalEndDate(wxMerchant.getRentalEndDate()); | |||
| wxRentContract.setPrice(wxMerchant.getPrice()); | |||
| wxRentContract.setSignDate(date); | |||
| wxRentContract.setPayArea(new BigDecimal(0)); | |||
| wxRentContract.setReceivePeriod(0); | |||
| wxRentContractMapper.updateByPrimaryKeySelective(wxRentContract); | |||
| //删除当前商户关联的所有商铺然后再插入 | |||
| WxMerchantShop wxMerchantShopQuery = new WxMerchantShop(); | |||
| wxMerchantShopQuery.setTenantId(wxMerchant.getTenantId()); | |||
| @@ -22,9 +22,12 @@ import com.simple.pay.*; | |||
| import com.simple.service.WxOrderService; | |||
| import com.simple.service.WxPayOrderService; | |||
| import com.simple.utils.*; | |||
| import io.swagger.models.auth.In; | |||
| import jdk.nashorn.internal.ir.IdentNode; | |||
| import me.chanjar.weixin.common.error.WxErrorException; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.log4j.Logger; | |||
| import org.omg.PortableInterceptor.SYSTEM_EXCEPTION; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import com.simple.common.IdWorker; | |||
| @@ -63,6 +66,8 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| @Autowired | |||
| WxMerchantMapper wxMerchantMapper; | |||
| @Autowired | |||
| WxProfitSharingReceiverMapper wxProfitSharingReceiverMapper; | |||
| JSONObject errorMap = JSON.parseObject("{" + | |||
| "\"NOAUTH\":{\"detail\":\"商户无此接口权限\",\"reason\":\"商户未开通此接口权限\",\"resolution\":\"请商户前往申请此接口权限\"}," + | |||
| @@ -94,9 +99,11 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| "\"XML_FORMAT_ERROR\":{\"detail\":\"XML格式错误\t\",\"reason\":\"XML格式错误\",\"reason\":\"请检查XML参数格式是否正确\"}}"); | |||
| @Override | |||
| public ResultData createPayOrder(boolean isReal, boolean isShare, WxAppinfo appInfo, WxCUser user, WxPayOrder record, EnumPayWay payWay) { | |||
| public ResultData createPayOrder(boolean isReal, WxAppinfo appInfo, WxCUser user, WxPayOrder record, EnumPayWay payWay) { | |||
| final IdWorker idworker = IdWorker.get(); | |||
| EnumPayShare isShare = EnumPayShare.NO; | |||
| try { | |||
| // 1. check 订单 | |||
| WxOrder order = wxOrderMapper.selectByPrimaryKey(record.getOrderId()); | |||
| @@ -111,6 +118,21 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| if (order.getPaymentType() != EnumPayType.PAY_PAYMENT.getCode()) { | |||
| return new ResultData(ErrorCode.PAY_ORDER_IS_NOT_PAYMENT); | |||
| } | |||
| WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(appInfo.getPayId()); | |||
| if (payAccount.isShare()) { | |||
| isShare = EnumPayShare.YES; | |||
| } | |||
| // 1.5 check 分账 receive | |||
| if (isShare == EnumPayShare.YES) { | |||
| WxProfitSharingReceiver receiver = new WxProfitSharingReceiver(); | |||
| receiver.setMerchantId(order.getMerchantId()); | |||
| List<WxProfitSharingReceiver> merList = wxProfitSharingReceiverMapper.findList(receiver); | |||
| if (merList.size() > 0) { | |||
| isShare = EnumPayShare.YES; | |||
| } else { | |||
| isShare = EnumPayShare.NO; | |||
| } | |||
| } | |||
| // 2. check 是否有支付订单 | |||
| Date currentDate = new Date(); | |||
| List<WxPayOrder> list = wxPayOrderMapper.findList(record); | |||
| @@ -121,7 +143,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| payOrderNo = String.valueOf(id); | |||
| record.setId(id); | |||
| record.setTenantId(user.getTenantId()); | |||
| record.setCUserId(user.getId()); | |||
| record.setcUserId(user.getId()); | |||
| record.setCreateTime(currentDate); | |||
| record.setUpdateTime(currentDate); | |||
| record.setPayTimeStart(currentDate); | |||
| @@ -131,6 +153,13 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| record.setPayAmount(order.getPayment()); | |||
| record.setPayVendor(EnumPayWay.PAY_WAY_WEAPP.getCode()); | |||
| record.setPayOrderStatus(EnumPayStatus.PAY_WAY_WAIT.getCode()); | |||
| record.setShare(isShare.getCode()); | |||
| if (isShare == EnumPayShare.YES) { | |||
| // 分账金额 | |||
| Double dChargeFee = Math.ceil(record.getPayAmount()*1.0D*payAccount.getRate()/1000); | |||
| Integer share_amount = record.getPayAmount() - dChargeFee.intValue(); | |||
| record.setShareAmount(share_amount); | |||
| } | |||
| int sqlRow = wxPayOrderMapper.insertSelective(record); | |||
| if (sqlRow != 1) { | |||
| @@ -139,10 +168,11 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| } | |||
| } else { | |||
| record = list.get(0); | |||
| record.setShare(isShare.getCode()); | |||
| payOrderNo = String.valueOf(record.getId()); | |||
| } | |||
| WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(appInfo.getPayId()); | |||
| if (isReal) { | |||
| // 微信实际支付 | |||
| if (payAccount.getType() == EnumPayMode.MCH.getCode()) { | |||
| @@ -205,6 +235,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| // 统一下单 // 服务商模式 | |||
| String noncestr = Utility.generate32UUID(); | |||
| WxPayOrderSP wxPayOrderSP = new WxPayOrderSP(); | |||
| wxPayOrderSP.setSub_openid(user.getOpenId()); | |||
| wxPayOrderSP.setAppid(appInfo.getParentAppId()); | |||
| wxPayOrderSP.setMch_id(payAccount.getMchId()); | |||
| wxPayOrderSP.setSub_appid(user.getAppId()); | |||
| @@ -221,11 +252,13 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| Date futureDate = new Date(); | |||
| futureDate.setTime(currentDate.getTime() + 15*60*1000); | |||
| wxPayOrderSP.setTime_expire(Utility.getDataFormatStringYYYYMMDDHHmmss(futureDate)); // 15分钟后结束 | |||
| Map<String, String> payOrderMap = BeanUtils.toStringMap(wxPayOrderSP); | |||
| if(isShare) { | |||
| payOrderMap.put("profit_sharing", "Y"); | |||
| wxPayOrderSP.setSign_type("HMAC-SHA256"); | |||
| if(isShare == EnumPayShare.YES) { | |||
| wxPayOrderSP.setProfit_sharing("Y"); | |||
| } | |||
| wxPayOrderSP.setSign(WxPayment.createSign(payOrderMap, payAccount.getApiKey())); | |||
| Map<String, String> payOrderMap = BeanUtils.toStringMap(wxPayOrderSP); | |||
| wxPayOrderSP.setSign(WxPayment.createSignHMAC(payOrderMap, payAccount.getApiKey())); | |||
| String response = WxPay.pushOrder(BeanUtils.toStringMap(wxPayOrderSP)); | |||
| logger.info("pay order, wechat pushOrder, " + wxPayOrderSP.toString() + ", response: " + response.toString()); | |||
| Map<String, String> returnMap = WxPayment.xmlToMap(response); | |||
| @@ -245,16 +278,17 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| String timestamp = String.valueOf(Utility.getCurrentTimeStamp()); | |||
| Map<String, String> sighMap = MapUtil.getOrderMap(); | |||
| sighMap.put("appId", returnMap.get("appid")); | |||
| sighMap.put("appId", appInfo.getAppId()); | |||
| sighMap.put("timeStamp", timestamp); | |||
| sighMap.put("nonceStr", noncestr); | |||
| sighMap.put("package", "prepay_id=" + prepay_id); | |||
| sighMap.put("signType", "MD5"); | |||
| String signAgent = WxPayment.createSign(sighMap, payAccount.getApiKey()); | |||
| sighMap.put("signType", "HMAC-SHA256"); | |||
| String signAgent = WxPayment.createSignHMAC(sighMap, payAccount.getApiKey()); | |||
| returnMap.put("timeStamp", timestamp); | |||
| returnMap.put("nonceStr", noncestr); | |||
| returnMap.put("package", "prepay_id=" + prepay_id); | |||
| returnMap.put("paySign", signAgent); | |||
| returnMap.put("signType", "HMAC-SHA256"); | |||
| logger.info("back to UI: " +returnMap.toString()); | |||
| return new ResultData(Result.SUCCESS, "创建支付订单成功", returnMap); | |||
| } else { | |||
| @@ -356,10 +390,11 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| payOrderSQ.setSub_mch_id(payAccount.getSubMchId()); | |||
| payOrderSQ.setNonce_str(noncestr); | |||
| payOrderSQ.setOut_trade_no(record.getPayOrderNo()); | |||
| payOrderSQ.setSign_type("HMAC-SHA256"); | |||
| try { | |||
| Map map = BeanUtils.toStringMap(payOrderSQ); | |||
| payOrderSQ.setSign(WxPayment.createSign(map, payAccount.getApiKey())); | |||
| payOrderSQ.setSign(WxPayment.createSignHMAC(map, payAccount.getApiKey())); | |||
| map = BeanUtils.toStringMap(payOrderSQ); | |||
| String response = WxPay.orderQuery(map); | |||
| @@ -446,10 +481,11 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| payOrderSC.setSub_mch_id(payAccount.getSubMchId()); | |||
| payOrderSC.setNonce_str(noncestr); | |||
| payOrderSC.setOut_trade_no(record.getPayOrderNo()); | |||
| payOrderSC.setSign_type("HMAC-SHA256"); | |||
| try { | |||
| Map map = BeanUtils.toStringMap(payOrderSC); | |||
| payOrderSC.setSign(WxPayment.createSign(map, payAccount.getApiKey())); | |||
| payOrderSC.setSign(WxPayment.createSignHMAC(map, payAccount.getApiKey())); | |||
| map = BeanUtils.toStringMap(payOrderSC); | |||
| String response = WxPay.closeOrder(map); | |||
| @@ -488,17 +524,21 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| String mchId = paramMap.get("mch_id"); | |||
| String subMchId = paramMap.get("sub_mch_id"); | |||
| WxAppinfo appinfo = null; | |||
| boolean isNormal = true; | |||
| if (StringUtils.isBlank(subAppId) && StringUtils.isBlank(subMchId)) { | |||
| // 普通商户号 | |||
| appinfo = wxAppinfoMapper.findByAppId(appId); | |||
| if (appinfo == null) { | |||
| throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); | |||
| } | |||
| isNormal = true; | |||
| } else { | |||
| // 服务号 现在用hmac-sha256 | |||
| appinfo = wxAppinfoMapper.findByAppId(subAppId); | |||
| if (appinfo == null) { | |||
| throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); | |||
| } | |||
| isNormal = false; | |||
| } | |||
| WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(appinfo.getPayId()); | |||
| @@ -509,12 +549,22 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| try { | |||
| if (payWay == EnumPayWay.PAY_WAY_WEAPP) { | |||
| boolean signVerified = false; | |||
| // 微信支付 | |||
| signVerified = WxPayment.verifyNotify(paramMap, partnerKey); | |||
| if (!signVerified) { | |||
| logger.warn("notify order, wxpay checksign error, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); | |||
| throw new MallinkException(ErrorCode.PAY_ORDER_NOTIFY_CHECK_SIGN_ERROR); | |||
| if (isNormal) { | |||
| // 普通商户号支付 | |||
| signVerified = WxPayment.verifyNotify(paramMap, partnerKey); | |||
| if (!signVerified) { | |||
| logger.warn("notify order, wxpay checksign error, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); | |||
| throw new MallinkException(ErrorCode.PAY_ORDER_NOTIFY_CHECK_SIGN_ERROR); | |||
| } | |||
| } else { | |||
| // 服务号 现在用hmac-sha256 | |||
| signVerified = WxPayment.verifyNotifyHMAC(paramMap, partnerKey); | |||
| if (!signVerified) { | |||
| logger.warn("notify order, wxpay checksign error, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); | |||
| throw new MallinkException(ErrorCode.PAY_ORDER_NOTIFY_CHECK_SIGN_ERROR); | |||
| } | |||
| } | |||
| if (!"SUCCESS".equals(paramMap.get("return_code"))) { | |||
| logger.warn("notify order, wxpay status not success, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); | |||
| SortedMap resultMap = new TreeMap(); | |||
| @@ -866,4 +916,12 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| throw new MallinkException(ErrorCode.TEMPLATE_SEND_FAILED); | |||
| } | |||
| } | |||
| public static void main(String [] args) { | |||
| Integer v = 500; | |||
| Integer rate = 6; | |||
| Double dChargeFee = Math.ceil(v*1.0D*6/1000); | |||
| Integer share_amount = v - dChargeFee.intValue(); | |||
| System.out.println("share value " + share_amount); | |||
| } | |||
| } | |||
| @@ -10,10 +10,7 @@ import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.ErrorCode; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.*; | |||
| import com.simple.enums.EnumPayDomain; | |||
| import com.simple.enums.EnumProfitSharingReceiverType; | |||
| import com.simple.enums.EnumProfitSharingStatus; | |||
| import com.simple.enums.EnumProfitSharingType; | |||
| import com.simple.enums.*; | |||
| import com.simple.exception.MallinkException; | |||
| import com.simple.mapper.*; | |||
| import com.simple.pay.WxPayment; | |||
| @@ -23,14 +20,17 @@ import com.simple.pay.WxProfitSharingQueryP; | |||
| import com.simple.service.WxProfitSharingOrderService; | |||
| import com.simple.utils.BeanUtils; | |||
| import com.simple.utils.Utility; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import com.simple.common.IdWorker; | |||
| import org.springframework.transaction.annotation.Propagation; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| @Service | |||
| public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderService { | |||
| private Logger logger = Logger.getLogger(getClass()); | |||
| @Autowired | |||
| WxProfitSharingOrderMapper wxProfitSharingOrderMapper; | |||
| @@ -124,12 +124,14 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| } | |||
| private WxAppinfo getAppinfo(WxPayOrder wxPayOrder) { | |||
| WxAppinfo wxAppinfo; | |||
| WxAppinfo wxAppinfo = new WxAppinfo(); | |||
| WxCUser wxCUser = wxCUserMapper.selectByPrimaryKey(wxPayOrder.getCUserId()); | |||
| 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()); | |||
| wxAppinfo.setAppId(wxCUser.getAppId()); | |||
| wxAppinfo = wxAppinfoMapper.selectOne(wxAppinfo); | |||
| if (wxAppinfo == null) | |||
| throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND.getCode(), ErrorCode.APP_ID_NOT_FOUND.getMessage()); | |||
| @@ -137,201 +139,217 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| } | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public ResultData createSharingOrder(WxPayOrder wxPayOrder) { | |||
| final IdWorker idworker = IdWorker.get(); | |||
| try { | |||
| WxAppinfo appInfo = getAppinfo(wxPayOrder); | |||
| WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(appInfo.getPayId()); | |||
| WxAppinfo appInfo = getAppinfo(wxPayOrder); | |||
| WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(appInfo.getPayId()); | |||
| WxOrder wxOrder = wxOrderMapper.selectByPrimaryKey(wxPayOrder.getOrderId()); | |||
| WxOrder wxOrder = wxOrderMapper.selectByPrimaryKey(wxPayOrder.getOrderId()); | |||
| //是否已创建分账订单 | |||
| WxProfitSharingOrder record = new WxProfitSharingOrder(); | |||
| //是否已创建分账订单 | |||
| WxProfitSharingOrder record = new WxProfitSharingOrder(); | |||
| record.setOrderId(wxPayOrder.getId()); | |||
| record = wxProfitSharingOrderMapper.selectOne(record); | |||
| if (record == null) { | |||
| //创建分账订单 | |||
| Date currentDate = new Date(); | |||
| record = new WxProfitSharingOrder(); | |||
| record.setId(idworker.nextId()); | |||
| record.setTenantId(wxPayOrder.getTenantId()); | |||
| record.setTransactionId(wxPayOrder.getTransactionId()); | |||
| record.setOrderId(wxPayOrder.getId()); | |||
| record = wxProfitSharingOrderMapper.selectOne(record); | |||
| if (record == null) { | |||
| //创建分账订单 | |||
| Date currentDate = new Date(); | |||
| record = new WxProfitSharingOrder(); | |||
| record.setId(idworker.nextId()); | |||
| record.setTenantId(wxPayOrder.getTenantId()); | |||
| record.setTransactionId(wxPayOrder.getTransactionId()); | |||
| record.setOrderId(wxPayOrder.getId()); | |||
| record.setPayAmount(wxPayOrder.getPayAmount()); | |||
| record.setMerchantId(wxOrder.getMerchantId()); | |||
| record.setCreateTime(currentDate); | |||
| record.setUpdateTime(currentDate); | |||
| record.setPayTimeStart(currentDate); | |||
| record.setPayTimeEnd(currentDate); | |||
| wxProfitSharingOrderMapper.insertSelective(record); | |||
| } | |||
| record.setPayAmount(wxPayOrder.getPayAmount()); | |||
| record.setMerchantId(wxOrder.getMerchantId()); | |||
| record.setSharingStatus(EnumProfitSharingStatus.PROFIT_SHARING_UNKNOWN.getCode()); | |||
| record.setCreateTime(currentDate); | |||
| record.setUpdateTime(currentDate); | |||
| record.setPayTimeStart(currentDate); | |||
| record.setPayTimeEnd(currentDate); | |||
| wxProfitSharingOrderMapper.insertSelective(record); | |||
| } | |||
| //分账提交 | |||
| WxProfitSharingP wxProfitSharingP = new WxProfitSharingP(); | |||
| wxProfitSharingP.setAppid(appInfo.getParentAppId()); | |||
| wxProfitSharingP.setMch_id(payAccount.getMchId()); | |||
| wxProfitSharingP.setSub_appid(appInfo.getAppId()); | |||
| wxProfitSharingP.setSub_mch_id(payAccount.getSubMchId()); | |||
| wxProfitSharingP.setNonce_str(Utility.generate32UUID()); | |||
| wxProfitSharingP.setTransaction_id(wxPayOrder.getTransactionId()); | |||
| wxProfitSharingP.setOut_trade_no(record.getId().toString()); | |||
| //添加分账接受方 | |||
| WxProfitSharingReceiver wxProfitSharingReceiver = new WxProfitSharingReceiver(); | |||
| wxProfitSharingReceiver.setMerchantId(wxOrder.getMerchantId()); | |||
| wxProfitSharingReceiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT.getCode()); | |||
| List<WxProfitSharingReceiver> wxProfitSharingReceiverList = wxProfitSharingReceiverMapper.findList(wxProfitSharingReceiver); | |||
| if (wxProfitSharingReceiverList.size()<=0 || wxProfitSharingReceiverList.size() > 50) { | |||
| throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_INVALID.getCode(), ErrorCode.PROFIT_SHARING_RECEIVER_INVALID.getMessage()); | |||
| } | |||
| JSONArray receivers = new JSONArray(); | |||
| List <WxProfitSharingResult> resultList = new ArrayList<WxProfitSharingResult>(); | |||
| for (int i=0;i<wxProfitSharingReceiverList.size();i++){ | |||
| WxProfitSharingReceiver receiver = wxProfitSharingReceiverList.get(i); | |||
| Date currentDate = new Date(); | |||
| JSONObject jo = new JSONObject(); | |||
| jo.put("type",EnumProfitSharingReceiverType.getEnum(receiver.getReceiverType()).getMessage()); | |||
| jo.put("account",receiver.getReceiverAccount()); | |||
| jo.put("amount",record.getPayAmount()); //temp: sharing all money with only owner | |||
| jo.put("description",receiver.getReceiverComments()); | |||
| receivers.add(jo); | |||
| WxProfitSharingResult result = new WxProfitSharingResult(); | |||
| result.setId(idworker.nextId()); | |||
| result.setSharingOrderId(record.getId()); | |||
| result.setSharingReceiverId(receiver.getId()); | |||
| result.setCreateTime(currentDate); | |||
| result.setUpdateTime(currentDate); | |||
| resultList.add(result); | |||
| } | |||
| //分账提交 | |||
| WxProfitSharingP wxProfitSharingP = new WxProfitSharingP(); | |||
| wxProfitSharingP.setAppid(appInfo.getParentAppId()); | |||
| wxProfitSharingP.setMch_id(payAccount.getMchId()); | |||
| wxProfitSharingP.setSub_appid(appInfo.getAppId()); | |||
| wxProfitSharingP.setSub_mch_id(payAccount.getSubMchId()); | |||
| wxProfitSharingP.setNonce_str(Utility.generate32UUID()); | |||
| wxProfitSharingP.setTransaction_id(wxPayOrder.getTransactionId()); | |||
| wxProfitSharingP.setOut_order_no(record.getId().toString()); | |||
| wxProfitSharingP.setSign_type("HMAC-SHA256"); | |||
| //添加分账接受方 | |||
| WxProfitSharingReceiver wxProfitSharingReceiver = new WxProfitSharingReceiver(); | |||
| wxProfitSharingReceiver.setMerchantId(wxOrder.getMerchantId()); | |||
| wxProfitSharingReceiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT.getCode()); | |||
| List<WxProfitSharingReceiver> wxProfitSharingReceiverList = wxProfitSharingReceiverMapper.findList(wxProfitSharingReceiver); | |||
| if (wxProfitSharingReceiverList.size()<=0 || wxProfitSharingReceiverList.size() > 50) { | |||
| throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_INVALID.getCode(), ErrorCode.PROFIT_SHARING_RECEIVER_INVALID.getMessage()); | |||
| } | |||
| wxProfitSharingP.setReceivers(receivers.toJSONString()); | |||
| JSONArray receivers = new JSONArray(); | |||
| List <WxProfitSharingResult> resultList = new ArrayList<WxProfitSharingResult>(); | |||
| for (int i=0;i<wxProfitSharingReceiverList.size();i++){ | |||
| WxProfitSharingReceiver receiver = wxProfitSharingReceiverList.get(i); | |||
| Date currentDate = new Date(); | |||
| JSONObject jo = new JSONObject(); | |||
| jo.put("type",EnumProfitSharingReceiverType.getEnum(receiver.getReceiverType()).getMessage()); | |||
| jo.put("account",receiver.getReceiverAccount()); | |||
| jo.put("amount", wxPayOrder.getShareAmount()); //temp: sharing all money with only owner | |||
| jo.put("description",receiver.getReceiverComments()); | |||
| receivers.add(jo); | |||
| wxProfitSharingP.setSign(WxPayment.createSign(BeanUtils.toStringMap(wxProfitSharingP), payAccount.getApiKey())); | |||
| String response = WxProfitSharing.pushOrder(BeanUtils.toStringMap(wxProfitSharingP)); | |||
| WxProfitSharingResult result = new WxProfitSharingResult(); | |||
| Map<String, String> returnMap = WxPayment.xmlToMap(response); | |||
| String return_code = returnMap.get("return_code"); | |||
| if (!"SUCCESS".equals(return_code)) { | |||
| record.setSharingStatus(EnumProfitSharingStatus.PROFIT_SHARING_REQ_FAILED.getCode()); | |||
| record.setUpdateTime(new Date()); | |||
| wxProfitSharingOrderMapper.updateByPrimaryKey(record); | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getCode(), returnMap.get("return_msg")); | |||
| } | |||
| result.setId(idworker.nextId()); | |||
| result.setSharingOrderId(record.getId()); | |||
| result.setSharingReceiverId(receiver.getId()); | |||
| result.setPayAmount(wxPayOrder.getShareAmount()); | |||
| result.setCreateTime(currentDate); | |||
| result.setUpdateTime(currentDate); | |||
| result.setSharingStatus(EnumProfitSharingResultStatus.PROFIT_SHARING_RESULT_PENDING.getCode()); | |||
| resultList.add(result); | |||
| } | |||
| if (!WxPayment.verifyNotify(returnMap,payAccount.getApiKey())){ | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_RETURN_INVALID.getCode(), ErrorCode.PROFIT_SHARING_RETURN_INVALID.getMessage()); | |||
| } | |||
| wxProfitSharingP.setReceivers(receivers.toJSONString()); | |||
| String result_code = returnMap.get("result_code"); | |||
| if (!"SUCCESS".equals(result_code)) { | |||
| record.setSharingStatus(EnumProfitSharingStatus.PROFIT_SHARING_APPLY_FAILED.getCode()); | |||
| record.setUpdateTime(new Date()); | |||
| wxProfitSharingOrderMapper.updateByPrimaryKey(record); | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_APPLY_FAILED.getCode(), returnMap.get("result_msg")); | |||
| } | |||
| String response; | |||
| try { | |||
| wxProfitSharingP.setSign(WxPayment.createSignHMAC(BeanUtils.toStringMap(wxProfitSharingP), payAccount.getApiKey())); | |||
| logger.info("wxProfitSharingP :" + wxProfitSharingP.toString()); | |||
| response = WxProfitSharing.pushOrder(BeanUtils.toStringMap(wxProfitSharingP), payAccount.getCertPath(), payAccount.getMchId()); | |||
| }catch (Exception e) { | |||
| record.setSharingStatus(EnumProfitSharingStatus.PROFIT_SHARING_REQ_FAILED.getCode()); | |||
| record.setErrorMsg(ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getMessage()); | |||
| record.setUpdateTime(new Date()); | |||
| wxProfitSharingOrderMapper.updateByPrimaryKey(record); | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getCode(), ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getMessage()+e.getMessage()); | |||
| } | |||
| logger.info("response: " + response); | |||
| Map<String, String> returnMap = WxPayment.xmlToMap(response); | |||
| String return_code = returnMap.get("return_code"); | |||
| record.setSharingOrderNo(returnMap.get("order_id")); | |||
| record.setSharingStatus(EnumProfitSharingStatus.PROFIT_SHARING_ACCEPTED.getCode()); | |||
| if (!"SUCCESS".equals(return_code)) { | |||
| record.setSharingStatus(EnumProfitSharingStatus.PROFIT_SHARING_REQ_FAILED.getCode()); | |||
| record.setErrorMsg(returnMap.get("return_msg")); | |||
| record.setUpdateTime(new Date()); | |||
| wxProfitSharingOrderMapper.updateByPrimaryKey(record); | |||
| wxProfitSharingResultMapper.insertList(resultList); | |||
| return new ResultData(returnMap); | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getCode(), returnMap.get("return_msg")); | |||
| } | |||
| } catch (Exception e) { | |||
| throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); | |||
| if (!WxPayment.verifyNotifyHMAC(returnMap,payAccount.getApiKey())){ | |||
| record.setErrorMsg(ErrorCode.PROFIT_SHARING_RETURN_INVALID.getMessage()); | |||
| record.setUpdateTime(new Date()); | |||
| wxProfitSharingOrderMapper.updateByPrimaryKey(record); | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_RETURN_INVALID.getCode(), ErrorCode.PROFIT_SHARING_RETURN_INVALID.getMessage()); | |||
| } | |||
| String result_code = returnMap.get("result_code"); | |||
| if (!"SUCCESS".equals(result_code)) { | |||
| record.setSharingStatus(EnumProfitSharingStatus.PROFIT_SHARING_APPLY_FAILED.getCode()); | |||
| record.setUpdateTime(new Date()); | |||
| record.setErrorMsg(returnMap.get("result_msg")); | |||
| wxProfitSharingOrderMapper.updateByPrimaryKey(record); | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_APPLY_FAILED.getCode(), returnMap.get("result_msg")); | |||
| } | |||
| record.setSharingOrderNo(returnMap.get("order_id")); | |||
| record.setSharingStatus(EnumProfitSharingStatus.PROFIT_SHARING_ACCEPTED.getCode()); | |||
| record.setUpdateTime(new Date()); | |||
| wxProfitSharingOrderMapper.updateByPrimaryKey(record); | |||
| for (WxProfitSharingResult result:resultList) | |||
| wxProfitSharingResultMapper.insertSelective(result); | |||
| return new ResultData(returnMap); | |||
| } | |||
| @Override | |||
| public ResultData querySharingOrder(WxPayOrder wxPayOrder) { | |||
| WxProfitSharingOrder record = new WxProfitSharingOrder(); | |||
| try { | |||
| WxAppinfo appInfo = getAppinfo(wxPayOrder); | |||
| WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(appInfo.getPayId()); | |||
| //是否已创建分账订单 | |||
| record.setOrderId(wxPayOrder.getId()); | |||
| 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();; | |||
| wxProfitSharingQueryP.setMch_id(payAccount.getMchId()); | |||
| wxProfitSharingQueryP.setSub_mch_id(payAccount.getSubMchId()); | |||
| 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")); | |||
| } | |||
| WxAppinfo appInfo = getAppinfo(wxPayOrder); | |||
| WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(appInfo.getPayId()); | |||
| //是否已创建分账订单 | |||
| record.setOrderId(wxPayOrder.getId()); | |||
| record = wxProfitSharingOrderMapper.selectOne(record); | |||
| if (record == null) | |||
| return new ResultData(ErrorCode.ORDER_IS_NOT_FIND.getCode(), ErrorCode.ORDER_IS_NOT_FIND.getMessage()); | |||
| //分账查询提交 | |||
| WxProfitSharingQueryP wxProfitSharingQueryP = new WxProfitSharingQueryP();; | |||
| wxProfitSharingQueryP.setMch_id(payAccount.getMchId()); | |||
| wxProfitSharingQueryP.setSub_mch_id(payAccount.getSubMchId()); | |||
| wxProfitSharingQueryP.setNonce_str(Utility.generate32UUID()); | |||
| wxProfitSharingQueryP.setTransaction_id(wxPayOrder.getTransactionId()); | |||
| wxProfitSharingQueryP.setOut_trade_no(record.getId().toString()); | |||
| wxProfitSharingQueryP.setSign_type("HMAC-SHA256"); | |||
| String response; | |||
| try { | |||
| wxProfitSharingQueryP.setSign(WxPayment.createSignHMAC(BeanUtils.toStringMap(wxProfitSharingQueryP), payAccount.getApiKey())); | |||
| response = WxProfitSharing.pushOrder(BeanUtils.toStringMap(wxProfitSharingQueryP), payAccount.getCertPath(), payAccount.getMchId()); | |||
| }catch (Exception e){ | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_QUERY_REQUEST_FAILED.getCode(), ErrorCode.PROFIT_SHARING_QUERY_REQUEST_FAILED.getMessage()+e.getMessage()); | |||
| } | |||
| 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()); | |||
| } | |||
| if (!WxPayment.verifyNotifyHMAC(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 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")); | |||
| } | |||
| 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); | |||
| 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); | |||
| String receivers = returnMap.get("receivers"); | |||
| JSONArray jReceivers = JSONArray.parseArray(receivers); | |||
| WxProfitSharingResult result = new WxProfitSharingResult(); | |||
| result.setSharingOrderId(record.getId()); | |||
| List <WxProfitSharingResult> wxProfitSharingResultList = wxProfitSharingResultMapper.findList(result); | |||
| WxProfitSharingResult result = new WxProfitSharingResult(); | |||
| result.setSharingOrderId(record.getId()); | |||
| List <WxProfitSharingResult> wxProfitSharingResultList = wxProfitSharingResultMapper.findList(result); | |||
| WxProfitSharingReceiver wxProfitSharingReceiver; | |||
| WxProfitSharingResult wxProfitSharingResult; | |||
| WxProfitSharingReceiver wxProfitSharingReceiver; | |||
| WxProfitSharingResult wxProfitSharingResult; | |||
| for(int i=0; i<wxProfitSharingResultList.size();i++) { | |||
| wxProfitSharingResult = wxProfitSharingResultList.get(i); | |||
| wxProfitSharingReceiver = wxProfitSharingReceiverMapper | |||
| .selectByPrimaryKey(wxProfitSharingResult.getSharingReceiverId()); | |||
| 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); | |||
| 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())) { | |||
| 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); | |||
| } | |||
| 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 (Exception e) { | |||
| throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); | |||
| } | |||
| return new ResultData(returnMap); | |||
| } | |||
| } | |||
| @@ -111,6 +111,7 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||
| wxProfitSharingReceiverP.setSub_appid(appInfo.getAppId()); | |||
| wxProfitSharingReceiverP.setSub_mch_id(payAccount.getSubMchId()); | |||
| wxProfitSharingReceiverP.setNonce_str(Utility.generate32UUID()); | |||
| wxProfitSharingReceiverP.setSign_type("HMAC-SHA256"); | |||
| JSONObject receiverJSON = new JSONObject(); | |||
| @@ -121,7 +122,7 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||
| wxProfitSharingReceiverP.setReceiver(receiverJSON.toJSONString()); | |||
| String response; | |||
| try { | |||
| wxProfitSharingReceiverP.setSign(WxPayment.createSign(BeanUtils.toStringMap(wxProfitSharingReceiverP), payAccount.getApiKey())); | |||
| wxProfitSharingReceiverP.setSign(WxPayment.createSignHMAC(BeanUtils.toStringMap(wxProfitSharingReceiverP), payAccount.getApiKey())); | |||
| response = WxProfitSharing.addReceiver(BeanUtils.toStringMap(wxProfitSharingReceiverP)); | |||
| }catch (Exception e) { | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_RECEIVER_ADD_FAILED, e.getMessage()); | |||
| @@ -132,13 +133,13 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_RECEIVER_ADD_FAILED.getCode(), returnMap.get("return_msg")); | |||
| } | |||
| if (!WxPayment.verifyNotify(returnMap,payAccount.getApiKey())){ | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_RECEIVER_ADD_FAILED.getCode(), ErrorCode.PROFIT_SHARING_RECEIVER_ADD_FAILED.getMessage()); | |||
| } | |||
| String result_code = returnMap.get("result_code"); | |||
| if (!"SUCCESS".equals(result_code)) { | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_RECEIVER_ADD_FAILED.getCode(), returnMap.get("result_msg")); | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_RECEIVER_ADD_FAILED.getCode(), returnMap.get("err_code_des")); | |||
| } | |||
| if (!WxPayment.verifyNotifyHMAC(returnMap,payAccount.getApiKey())){ | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_RECEIVER_ADD_FAILED.getCode(), ErrorCode.PROFIT_SHARING_RECEIVER_ADD_FAILED.getMessage()); | |||
| } | |||
| wxProfitSharingReceiverMapper.insertSelective(receiver); | |||
| @@ -171,7 +172,7 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||
| wxProfitSharingReceiverP.setSub_appid(appInfo.getAppId()); | |||
| wxProfitSharingReceiverP.setSub_mch_id(payAccount.getSubMchId()); | |||
| wxProfitSharingReceiverP.setNonce_str(Utility.generate32UUID()); | |||
| wxProfitSharingReceiverP.setSign_type("HMAC-SHA256"); | |||
| JSONObject receiverJSON = new JSONObject(); | |||
| receiverJSON.put("type",EnumProfitSharingReceiverType.getEnum(receiver.getReceiverType()).getMessage()); | |||
| @@ -180,7 +181,7 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||
| wxProfitSharingReceiverP.setReceiver(receiverJSON.toJSONString()); | |||
| String response; | |||
| try { | |||
| wxProfitSharingReceiverP.setSign(WxPayment.createSign(BeanUtils.toStringMap(wxProfitSharingReceiverP), payAccount.getApiKey())); | |||
| wxProfitSharingReceiverP.setSign(WxPayment.createSignHMAC(BeanUtils.toStringMap(wxProfitSharingReceiverP), payAccount.getApiKey())); | |||
| response = WxProfitSharing.addReceiver(BeanUtils.toStringMap(wxProfitSharingReceiverP)); | |||
| }catch (Exception e) { | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED, e.getMessage()); | |||
| @@ -191,15 +192,15 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getCode(), returnMap.get("return_msg")); | |||
| } | |||
| if (!WxPayment.verifyNotify(returnMap,payAccount.getApiKey())){ | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getCode(), ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getMessage()); | |||
| } | |||
| String result_code = returnMap.get("result_code"); | |||
| if (!"SUCCESS".equals(result_code)) { | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getCode(), returnMap.get("result_msg")); | |||
| } | |||
| if (!WxPayment.verifyNotifyHMAC(returnMap,payAccount.getApiKey())){ | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getCode(), ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getMessage()); | |||
| } | |||
| wxProfitSharingReceiverMapper.deleteByPrimaryKey(receiver); | |||
| return new ResultData(returnMap); | |||
| } | |||
| @@ -334,7 +334,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| // 查找支付订单 | |||
| WxPayOrder payOrderQ = new WxPayOrder(); | |||
| payOrderQ.setTenantId(appInfo.getTenantId()); | |||
| payOrderQ.setCUserId(wxOrder.getCUserId()); | |||
| payOrderQ.setcUserId(wxOrder.getCUserId()); | |||
| payOrderQ.setOrderId(wxOrder.getId()); | |||
| payOrderQ.setPayOrderStatus(EnumPayStatus.PAY_WAY_SUCCESS.getCode()); | |||
| @@ -365,7 +365,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| record.setUpdateTime(currentDate); | |||
| // 微信内部订单号 | |||
| record.setTransactionId(payOrder.getTransactionId()); | |||
| record.setCUserId(payOrder.getCUserId()); | |||
| record.setCUserId(payOrder.getcUserId()); | |||
| record.setTotalFee(payOrder.getPayAmount()); | |||
| record.setRefundFee(payOrder.getPayAmount()); | |||
| record.setRefundTimeStart(currentDate); | |||
| @@ -391,6 +391,10 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| logger.error("证书路径为空"); | |||
| throw new MallinkException(ErrorCode.CERT_PATH_NOT_FOUND.getCode(), "证书路径为空,请联系商城管理员"); | |||
| } | |||
| if (!Utility.isFileExist(payAccount.getCertPath())) { | |||
| logger.error("证书文件不存在"); | |||
| throw new MallinkException(ErrorCode.CERT_PATH_NOT_FOUND.getCode(), "证书文件不存在,请联系商城管理员"); | |||
| } | |||
| // check 是否有退款订单 | |||
| List<WxRefundOrder> refundList = wxRefundOrderMapper.findList(record); | |||
| if (refundList.size() > 0) { | |||
| @@ -402,6 +406,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| // 实际支付 | |||
| // 向微信提交退款申请 | |||
| if (payAccount.getType() == EnumPayMode.MCH.getCode()) { | |||
| // 普通商户模式 | |||
| String noncestr = Utility.generate32UUID(); | |||
| WxRefundOrderP wxRefundOrderP = new WxRefundOrderP(); | |||
| wxRefundOrderP.setAppid(appInfo.getAppId()); | |||
| @@ -474,6 +479,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| } | |||
| } | |||
| } else { | |||
| // 服务商模式 | |||
| String noncestr = Utility.generate32UUID(); | |||
| WxRefundOrderSP wxRefundOrderSP = new WxRefundOrderSP(); | |||
| wxRefundOrderSP.setAppid(appInfo.getParentAppId()); | |||
| @@ -500,6 +506,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| wxRefundOrderSP.setRefund_desc("用户自己退款"); | |||
| } | |||
| wxRefundOrderSP.setNotify_url(payAccount.getNotifyUrl() + "/refund"); | |||
| wxRefundOrderSP.setSign_type("HMAC-SHA256"); | |||
| Map signMap = null; | |||
| try { | |||
| @@ -509,7 +516,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), "退款签名异常"); | |||
| } | |||
| String signAgent = WxPayment.createSign(signMap, payAccount.getApiKey()); | |||
| String signAgent = WxPayment.createSignHMAC(signMap, payAccount.getApiKey()); | |||
| signMap.put("sign", signAgent); | |||
| String response = null; | |||
| try { | |||
| @@ -661,7 +668,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| logger.error("未找到mch_id信息:"+mchId); | |||
| throw new MallinkException(ErrorCode.MCH_INFO_NOT_FOUND); | |||
| } | |||
| if (mchId != payAccount.getMchId()) { | |||
| if (!mchId.equalsIgnoreCase(payAccount.getMchId())) { | |||
| logger.error("mch_id不对应:"+mchId + ",account:" + payAccount.getMchId()); | |||
| throw new MallinkException(ErrorCode.MCH_INFO_NOT_EQUAL); | |||
| } | |||
| @@ -752,7 +759,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| logger.error("未找到mch_id信息:"+mchId); | |||
| throw new MallinkException(ErrorCode.MCH_INFO_NOT_FOUND); | |||
| } | |||
| if (mchId != payAccount.getMchId()) { | |||
| if (!mchId.equalsIgnoreCase(payAccount.getMchId())) { | |||
| logger.error("mch_id不对应:"+mchId + ",account:" + payAccount.getMchId()); | |||
| throw new MallinkException(ErrorCode.MCH_INFO_NOT_EQUAL); | |||
| } | |||
| @@ -761,7 +768,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| if (payWay == EnumPayWay.PAY_WAY_WEAPP) { | |||
| boolean signVerified = false; | |||
| // 微信支付 | |||
| signVerified = WxPayment.verifyNotify(paramMap, partnerKey); | |||
| signVerified = WxPayment.verifyNotifyHMAC(paramMap, partnerKey); | |||
| if (!signVerified) { | |||
| logger.warn("notify order, wxpay checksign error, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); | |||
| throw new MallinkException(ErrorCode.PAY_ORDER_NOTIFY_CHECK_SIGN_ERROR); | |||
| @@ -828,7 +835,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } | |||
| } catch (RuntimeException e) { | |||
| logger.warn("notify order, alipay checksign error, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString() + ", e:" + e.getMessage()); | |||
| logger.warn("notify order, wepay checksign error, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString() + ", e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR); | |||
| } | |||
| } | |||
| @@ -0,0 +1,53 @@ | |||
| package com.simple.service.impl; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.IdWorker; | |||
| import com.simple.domain.po.WxRentContract; | |||
| import com.simple.mapper.WxRentContractMapper; | |||
| import com.simple.service.WxRentContractService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| @Service | |||
| public class WxRentContractServiceImpl implements WxRentContractService { | |||
| @Autowired | |||
| WxRentContractMapper wxRentContractMapper; | |||
| @Override | |||
| public PageInfo<WxRentContract> listAsPage(WxRentContract record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxRentContractMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public WxRentContract getById(String id) { | |||
| return wxRentContractMapper.selectByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(WxRentContract record) { | |||
| if (record.getId() == null) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| wxRentContractMapper.insertSelective(record); | |||
| } else { | |||
| wxRentContractMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(String id) { | |||
| wxRentContractMapper.deleteByPrimaryKey(id); | |||
| } | |||
| } | |||
| @@ -72,10 +72,10 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||
| if (wxCUser.getPhone() != null) { | |||
| //修改basic表积分 | |||
| WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo(); | |||
| wxCUserBasicInfo.setId(wxCUser.getId()); | |||
| wxCUserBasicInfo.setTenantId(tenantId); | |||
| wxCUserBasicInfo.setPhone(wxCUser.getPhone()); | |||
| wxCUserBasicInfo.setPoins(wxCUser.getScore()); | |||
| wxCUserBasicInfo.setCUserId(wxCUser.getId()); | |||
| wxCUserBasicInfoService.updateScore(wxCUserBasicInfo); | |||
| } | |||
| return addScoreNumber; | |||
| @@ -106,10 +106,10 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||
| if (wxCUser.getPhone() != null) { | |||
| //修改basic表积分 | |||
| WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo(); | |||
| wxCUserBasicInfo.setId(wxCUser.getId()); | |||
| wxCUserBasicInfo.setTenantId(tenantId); | |||
| wxCUserBasicInfo.setPhone(wxCUser.getPhone()); | |||
| wxCUserBasicInfo.setPoins(wxCUser.getScore()); | |||
| wxCUserBasicInfo.setCUserId(wxCUser.getId()); | |||
| wxCUserBasicInfoService.updateScore(wxCUserBasicInfo); | |||
| } | |||
| return addScoreNumber; | |||
| @@ -3,6 +3,7 @@ package com.simple.service.impl; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxShop; | |||
| import com.simple.mapper.WxShopMapper; | |||
| import com.simple.service.WxShopService; | |||
| @@ -58,12 +59,24 @@ public class WxShopServiceImpl implements WxShopService { | |||
| public void deleteById(Long id) { | |||
| wxShopMapper.deleteByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public ResultData getbshoplist(String tenantId, String shopNumber) { | |||
| Map<String,Object> params=new HashMap<>(); | |||
| params.put("tenantId",tenantId); | |||
| params.put("shopNumber",shopNumber); | |||
| List<Map<String,Object>> list=wxShopMapper.getbshoplist(params); | |||
| return new ResultData(ResultData.SUCCESS,"",list); | |||
| } | |||
| @Override | |||
| public ResultData getMerchantShopByShopId(String tenantId, String shopId) { | |||
| Map<String,Object> params=new HashMap<>(); | |||
| params.put("tenantId",tenantId); | |||
| params.put("shopId",shopId); | |||
| Map<String,Object> map=wxShopMapper.getMerchantShopByShopId(params); | |||
| return new ResultData(ResultData.SUCCESS,"",map); | |||
| } | |||
| } | |||
| @@ -4,7 +4,6 @@ import okhttp3.MediaType; | |||
| import okhttp3.OkHttpClient; | |||
| import okhttp3.Request; | |||
| import okhttp3.RequestBody; | |||
| import org.apache.commons.codec.Charsets; | |||
| import org.apache.commons.io.IOUtils; | |||
| import org.apache.http.*; | |||
| import org.apache.http.client.entity.UrlEncodedFormEntity; | |||
| @@ -19,6 +18,8 @@ import org.apache.http.message.BasicNameValuePair; | |||
| import org.apache.http.protocol.HTTP; | |||
| import org.apache.http.ssl.SSLContexts; | |||
| import org.apache.http.util.EntityUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import javax.net.ssl.HttpsURLConnection; | |||
| import javax.net.ssl.KeyManager; | |||
| @@ -34,7 +35,6 @@ import java.util.ArrayList; | |||
| import java.util.Iterator; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.logging.Logger; | |||
| /** | |||
| @@ -44,7 +44,7 @@ import java.util.logging.Logger; | |||
| */ | |||
| public class HttpUtil { | |||
| private static Logger logger = Logger.getLogger(String.valueOf(HttpUtil.class)); | |||
| private static final Logger logger = LoggerFactory.getLogger(ETCPUtil.class); | |||
| private static final MediaType CONTENT_TYPE_FORM = MediaType.parse("application/x-www-form-urlencoded"); | |||
| private static final String DEFAULT_USER_AGENT = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36"; | |||
| @@ -70,7 +70,8 @@ public class HttpUtil { | |||
| } | |||
| } | |||
| catch (IOException e) { | |||
| e.printStackTrace(); | |||
| logger.error(e.getMessage()); | |||
| throw new RuntimeException(e); | |||
| } | |||
| return null; | |||
| @@ -124,13 +125,12 @@ public class HttpUtil { | |||
| return sb.toString(); | |||
| } | |||
| else{ // | |||
| System.out.println("状态码:" + code); | |||
| logger.info("状态码:" + code); | |||
| client.close(); | |||
| } | |||
| } | |||
| catch(Exception e){ | |||
| e.printStackTrace(); | |||
| logger.error(e.getMessage()); | |||
| return null; | |||
| } | |||
| @@ -172,13 +172,13 @@ public class HttpUtil { | |||
| try { | |||
| response.close(); | |||
| } catch (IOException e) { | |||
| e.printStackTrace(); | |||
| logger.error(e.getMessage()); | |||
| } | |||
| } | |||
| try { | |||
| httpclient.close(); | |||
| } catch (IOException e) { | |||
| e.printStackTrace(); | |||
| logger.error(e.getMessage()); | |||
| } | |||
| } | |||
| return null; | |||
| @@ -196,6 +196,7 @@ public class HttpUtil { | |||
| .url(url).post(body).build(); | |||
| return exec(request); | |||
| } catch (IOException e) { | |||
| logger.error(e.getMessage()); | |||
| return null; | |||
| } | |||
| } | |||
| @@ -207,6 +208,7 @@ public class HttpUtil { | |||
| throw new RuntimeException("Unexpected code " + response); | |||
| return response.body().string(); | |||
| } catch (IOException e) { | |||
| logger.error(e.getMessage()); | |||
| throw new RuntimeException(e); | |||
| } | |||
| } | |||
| @@ -252,6 +254,7 @@ public class HttpUtil { | |||
| } | |||
| return sb.toString(); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| throw new RuntimeException(e); | |||
| } finally { | |||
| IOUtils.closeQuietly(out); | |||
| @@ -289,17 +292,17 @@ public class HttpUtil { | |||
| HttpPost httpPost = new HttpPost(url); | |||
| StringEntity entityStr = new StringEntity(xmlStr); | |||
| entityStr.setContentType("text/xml"); | |||
| System.out.println("entityStr--------------"+entityStr); | |||
| //logger.info("entityStr--------------"+entityStr); | |||
| httpPost.setEntity(entityStr); | |||
| CloseableHttpResponse response = httpclient.execute(httpPost); | |||
| try { | |||
| HttpEntity entity = response.getEntity(); | |||
| System.out.println("----------------------------------------"); | |||
| System.out.println(response.getStatusLine()); | |||
| //System.out.println("----------------------------------------"); | |||
| //System.out.println(response.getStatusLine()); | |||
| if (entity != null) { | |||
| System.out.println("Response content length: " + entity.getContentLength()); | |||
| //System.out.println("Response content length: " + entity.getContentLength()); | |||
| BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(entity.getContent())); | |||
| StringBuilder sb = new StringBuilder(); | |||
| String line = null; | |||
| @@ -4,6 +4,7 @@ package com.simple.utils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import java.io.File; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.math.BigDecimal; | |||
| import java.net.URLDecoder; | |||
| @@ -562,4 +563,13 @@ public final class Utility { | |||
| String ret = formatter.format(new Date(t)); | |||
| return ret; | |||
| } | |||
| public static boolean isFileExist(String filePath) { | |||
| File path=new File(filePath); | |||
| if(path.exists()){ | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| } | |||
| @@ -0,0 +1,101 @@ | |||
| <?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.WxBillRentMapper"> | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxBillRent"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="shop_id" jdbcType="BIGINT" property="shopId" /> | |||
| <result column="user_area" jdbcType="DECIMAL" property="userArea" /> | |||
| <result column="price" jdbcType="DECIMAL" property="price" /> | |||
| <result column="need_pay" jdbcType="DECIMAL" property="needPay" /> | |||
| <result column="receive_pay" jdbcType="DECIMAL" property="receivePay" /> | |||
| <result column="pay" jdbcType="DECIMAL" property="pay" /> | |||
| <result column="receive_period" jdbcType="INTEGER" property="receivePeriod" /> | |||
| <result column="receive_date" jdbcType="TIMESTAMP" property="receiveDate" /> | |||
| <result column="pay_date" jdbcType="TIMESTAMP" property="payDate" /> | |||
| <result column="createtime" jdbcType="TIMESTAMP" property="createtime" /> | |||
| <result column="expired_day" jdbcType="INTEGER" property="expiredDay" /> | |||
| <result column="pay_way" jdbcType="INTEGER" property="payWay" /> | |||
| <result column="receipt_num" jdbcType="VARCHAR" property="receiptNum" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="owe" jdbcType="DECIMAL" property="owe" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`shop_id`,`user_area`,`price`,`need_pay`,`receive_pay`,`pay`,`receive_period`,`receive_date`,`pay_date`,`createtime`,`expired_day`,`pay_way`,`receipt_num`,`tenant_id`,`owe` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> and `id` = #{id} </if> | |||
| <if test=" null != shopId "> and `shop_id` = #{shopId} </if> | |||
| <if test=" null != userArea "> and `user_area` = #{userArea} </if> | |||
| <if test=" null != price "> and `price` = #{price} </if> | |||
| <if test=" null != needPay "> and `need_pay` = #{needPay} </if> | |||
| <if test=" null != receivePay "> and `receive_pay` = #{receivePay} </if> | |||
| <if test=" null != pay "> and `pay` = #{pay} </if> | |||
| <if test=" null != receivePeriod "> and `receive_period` = #{receivePeriod} </if> | |||
| <if test=" null != receiveDate "> and `receive_date` = #{receiveDate} </if> | |||
| <if test=" null != payDate "> and `pay_date` = #{payDate} </if> | |||
| <if test=" null != createtime "> and `createtime` = #{createtime} </if> | |||
| <if test=" null != expiredDay "> and `expired_day` = #{expiredDay} </if> | |||
| <if test=" null != payWay "> and `pay_way` = #{payWay} </if> | |||
| <if test=" null != receiptNum "> and `receipt_num` = #{receiptNum} </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.WxBillRent" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_bill_rent | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="findListMap" parameterType="com.simple.domain.po.WxBillRent" resultType="hashmap"> | |||
| select br.id,br.shop_id shopId,br.user_area userArea,br.price,br.need_pay needPay,br.receive_pay receivePay, | |||
| br.pay,br.receive_period receivePeriod,br.receive_date receiveDate,br.pay_date payDate,br.createtime, | |||
| br.expired_day expiredDay,br.pay_way payWay,br.receipt_num receiptNum,m.`name` merchantName, | |||
| s.build_area buildArea,s.operation_area operationArea,s.shop_number shopNumber,br.owe | |||
| from wx_bill_rent br left join wx_merchant_shop ms on br.shop_id=ms.shop_id and ms.is_del=0 | |||
| inner join wx_merchant m on ms.merchant_id=m.id | |||
| inner join wx_shop s on ms.shop_id=s.id | |||
| where 1 = 1 | |||
| <if test=" null != id "> and br.`id` = #{id} </if> | |||
| <if test=" null != shopId "> and br.`shop_id` = #{shopId} </if> | |||
| <if test=" null != userArea "> and br.`user_area` = #{userArea} </if> | |||
| <if test=" null != price "> and br.`price` = #{price} </if> | |||
| <if test=" null != needPay "> and br.`need_pay` = #{needPay} </if> | |||
| <if test=" null != receivePay "> and br.`receive_pay` = #{receivePay} </if> | |||
| <if test=" null != pay "> and br.`pay` = #{pay} </if> | |||
| <if test=" null != receivePeriod "> and br.`receive_period` = #{receivePeriod} </if> | |||
| <if test=" null != receiveDate "> and br.`receive_date` = #{receiveDate} </if> | |||
| <if test=" null != payDate "> and br.`pay_date` = #{payDate} </if> | |||
| <if test=" null != createtime "> and br.`createtime` = #{createtime} </if> | |||
| <if test=" null != expiredDay "> and br.`expired_day` = #{expiredDay} </if> | |||
| <if test=" null != payWay "> and br.`pay_way` = #{payWay} </if> | |||
| <if test=" null != receiptNum "> and br.`receipt_num` = #{receiptNum} </if> | |||
| <if test=" null != tenantId "> and br.`tenant_id` = #{tenantId} </if> | |||
| <if test=" null != ids "> | |||
| and br.id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by br.${sortColumns} </if> | |||
| </select> | |||
| <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap"> | |||
| select sum(receive_pay) receivepay,sum(pay) pay,tenant_id from wx_bill_rent | |||
| where tenant_id=#{tenantId} and date_format(receive_date,'%Y-%m')=#{receiveDate} | |||
| group by tenant_id | |||
| </select> | |||
| </mapper> | |||
| @@ -1,172 +1,168 @@ | |||
| <?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.WxCUserBasicInfoMapper"> | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxCUserBasicInfo"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="phone" jdbcType="VARCHAR" property="phone" /> | |||
| <result column="birthdate" jdbcType="TIMESTAMP" property="birthdate" /> | |||
| <result column="education" jdbcType="VARCHAR" property="education" /> | |||
| <result column="sex" jdbcType="INTEGER" property="sex" /> | |||
| <result column="email" jdbcType="VARCHAR" property="email" /> | |||
| <result column="address" jdbcType="VARCHAR" property="address" /> | |||
| <result column="poins" jdbcType="INTEGER" property="poins" /> | |||
| <result column="tag_id" jdbcType="BIGINT" property="tagId" /> | |||
| <result column="c_user_id" jdbcType="BIGINT" property="cUserId" /> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="name" jdbcType="VARCHAR" property="name" /> | |||
| <result column="level" jdbcType="VARCHAR" property="level" /> | |||
| <result column="nick_name" jdbcType="VARCHAR" property="nickName" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`,`c_user_id`, | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxCUserBasicInfo"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="phone" jdbcType="VARCHAR" property="phone"/> | |||
| <result column="birthdate" jdbcType="TIMESTAMP" property="birthdate"/> | |||
| <result column="education" jdbcType="VARCHAR" property="education"/> | |||
| <result column="sex" jdbcType="INTEGER" property="sex"/> | |||
| <result column="email" jdbcType="VARCHAR" property="email"/> | |||
| <result column="address" jdbcType="VARCHAR" property="address"/> | |||
| <result column="poins" jdbcType="INTEGER" property="poins"/> | |||
| <result column="tag_id" jdbcType="BIGINT" property="tagId"/> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="name" jdbcType="VARCHAR" property="name"/> | |||
| <result column="level" jdbcType="VARCHAR" property="level"/> | |||
| <result column="nick_name" jdbcType="VARCHAR" property="nickName"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`, | |||
| `create_date`,`update_date`,`tenant_id`,`name`,level,nick_name | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != phone "> | |||
| and `phone` like concat('%', #{phone},'%') | |||
| </if> | |||
| <if test=" null != birthdate "> | |||
| and `birthdate` = #{birthdate} | |||
| </if> | |||
| <if test=" null != education "> | |||
| and `education` like concat('%', #{education},'%') | |||
| </if> | |||
| <if test=" null != sex "> | |||
| and `sex` = #{sex} | |||
| </if> | |||
| <if test=" null != email "> | |||
| and `email` like concat('%', #{email},'%') | |||
| </if> | |||
| <if test=" null != address "> | |||
| and `address` like concat('%', #{address},'%') | |||
| </if> | |||
| <if test=" null != poins "> | |||
| and `poins` = #{poins} | |||
| </if> | |||
| <if test=" null != tagId "> | |||
| and `tag_id` = #{tagId} | |||
| </if> | |||
| <if test=" null != cUserId "> | |||
| and `c_user_id` = #{cUserId} | |||
| </if> | |||
| <if test=" null != createDate "> | |||
| and `create_date` = #{createDate} | |||
| </if> | |||
| <if test=" null != updateDate "> | |||
| and `update_date` = #{updateDate} | |||
| </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 != 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 id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and c.`tenant_id` like concat('%', #{tenantId},'%') | |||
| </if> | |||
| <if test=" null != phone "> | |||
| and `phone` like concat('%', #{phone},'%') | |||
| </if> | |||
| <if test=" null != birthdate "> | |||
| and `birthdate` = #{birthdate} | |||
| </if> | |||
| <if test=" null != education "> | |||
| and `education` like concat('%', #{education},'%') | |||
| </if> | |||
| <if test=" null != sex "> | |||
| and `sex` = #{sex} | |||
| </if> | |||
| <if test=" null != email "> | |||
| and `email` like concat('%', #{email},'%') | |||
| </if> | |||
| <if test=" null != address "> | |||
| and `address` like concat('%', #{address},'%') | |||
| </if> | |||
| <if test=" null != poins "> | |||
| and `poins` = #{poins} | |||
| </if> | |||
| <if test=" null != tagId "> | |||
| and `tag_id` = #{tagId} | |||
| </if> | |||
| <if test=" null != cUserId "> | |||
| and `c_user_id` = #{cUserId} | |||
| </if> | |||
| <if test=" null != createDate "> | |||
| and c.`create_date` = #{createDate} | |||
| </if> | |||
| <if test=" null != updateDate "> | |||
| and c.`update_date` = #{updateDate} | |||
| </if> | |||
| <if test=" null != name "> | |||
| and c.`name` like concat('%', #{name},'%') | |||
| </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.WxCUserBasicInfo" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_c_user_basic_info | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <sql id="allUserColumns"> | |||
| c.`id`,c.`phone`,cb.`birthdate`,cb.`education`,cb.`sex`,cb.`email`,cb.`address`,cb.`poins`,cb.`tag_id`, | |||
| cb.`create_date`,cb.`update_date`,c.`tenant_id`,cb.`name`,cb.level,cb.nick_name | |||
| </sql> | |||
| <select id="findList" parameterType="com.simple.domain.po.WxCUserBasicInfo" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_c_user_basic_info | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="list" parameterType="com.simple.domain.dto.WxCuerBasicInfoDto" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_c_user_basic_info where 1=1 | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != phone and phone !='' "> | |||
| and `phone` = #{phone} | |||
| </if> | |||
| <if test=" null != startTime "> | |||
| and create_date >= #{startTime} | |||
| </if> | |||
| <if test=" null != endTime"> | |||
| and create_date <= #{endTime} | |||
| </if> | |||
| <if test=" null != name and name != '' "> | |||
| and `name` like concat('%', #{name},'%') | |||
| </if> | |||
| </select> | |||
| <update id="updateScore" parameterType="com.simple.domain.po.WxCUserBasicInfo"> | |||
| <select id="list" parameterType="com.simple.domain.dto.WxCUserBasicInfoDto" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allUserColumns"/> | |||
| from wx_c_user c | |||
| left join wx_c_user_basic_info cb on cb.id = c.id and cb.tenant_id = c.tenant_id | |||
| where 1=1 | |||
| <if test=" null != tenantId "> | |||
| and c.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != phone and phone !='' "> | |||
| and c.`phone` = #{phone} | |||
| </if> | |||
| <if test=" null == phone or phone =='' "> | |||
| and c.`phone` is not null | |||
| </if> | |||
| <if test=" null != startTime "> | |||
| and cb.create_date >= #{startTime} | |||
| </if> | |||
| <if test=" null != endTime"> | |||
| and cb.update_date <= #{endTime} | |||
| </if> | |||
| <if test=" null != name and name != '' "> | |||
| and cb.`name` like concat('%', #{name},'%') | |||
| </if> | |||
| </select> | |||
| <update id="updateScore" parameterType="com.simple.domain.po.WxCUserBasicInfo"> | |||
| update wx_c_user_basic_info set poins=#{poins} where phone=#{phone} and tenant_id=#{tenantId} | |||
| and c_user_id=#{cUserId} | |||
| </update> | |||
| <select id="findCountBySex" parameterType="com.simple.domain.dto.WxCuerBasicInfoDto" resultType="java.lang.Long"> | |||
| select count(id) from wx_c_user_basic_info where sex =#{sex} | |||
| <if test=" null != startTime "> | |||
| and create_date >= #{startTime} | |||
| </if> | |||
| <if test=" null != endTime"> | |||
| and create_date <= #{endTime} | |||
| </if> | |||
| </select> | |||
| <select id="findCountByAge" parameterType="com.simple.domain.dto.WxCuerBasicInfoDto" resultType="java.lang.Long"> | |||
| select count(id) from wx_c_user_basic_info where birthdate is not NULL | |||
| <if test=" null != startTime "> | |||
| and create_date >= #{startTime} | |||
| </if> | |||
| <if test=" null != endTime"> | |||
| and create_date <= #{endTime} | |||
| </if> | |||
| <if test=" null != birthStartTime "> | |||
| and birthdate >= #{birthStartTime} | |||
| </if> | |||
| <if test=" null != birthEndTime"> | |||
| and birthdate <= #{birthEndTime} | |||
| </if> | |||
| </select> | |||
| <select id="findCountBySex" parameterType="com.simple.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | |||
| select count(id) from wx_c_user_basic_info where sex =#{sex} | |||
| <if test=" null != startTime "> | |||
| and create_date >= #{startTime} | |||
| </if> | |||
| <if test=" null != endTime"> | |||
| and create_date <= #{endTime} | |||
| </if> | |||
| </select> | |||
| <select id="findCountByAge" parameterType="com.simple.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | |||
| select count(id) from wx_c_user_basic_info where birthdate is not NULL | |||
| <if test=" null != startTime "> | |||
| and create_date >= #{startTime} | |||
| </if> | |||
| <if test=" null != endTime"> | |||
| and create_date <= #{endTime} | |||
| </if> | |||
| <if test=" null != birthStartTime "> | |||
| and birthdate >= #{birthStartTime} | |||
| </if> | |||
| <if test=" null != birthEndTime"> | |||
| and birthdate <= #{birthEndTime} | |||
| </if> | |||
| </select> | |||
| </mapper> | |||
| @@ -184,7 +184,7 @@ | |||
| where `token` = #{token} | |||
| </select> | |||
| <select id="findCount" parameterType="com.simple.domain.dto.WxCuerBasicInfoDto" resultType="java.lang.Long"> | |||
| <select id="findCount" parameterType="com.simple.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | |||
| select count(id) from wx_c_user where 1=1 | |||
| <if test=" null != sex "> | |||
| and gender =#{sex} | |||
| @@ -8,11 +8,13 @@ | |||
| <result column="api_key" jdbcType="VARCHAR" property="apiKey"/> | |||
| <result column="notify_url" jdbcType="VARCHAR" property="notifyUrl"/> | |||
| <result column="cert_path" jdbcType="VARCHAR" property="certPath"/> | |||
| <result column="type" jdbcType="VARCHAR" property="type"/> | |||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||
| <result column="share" jdbcType="INTEGER" property="share"/> | |||
| <result column="rate" jdbcType="INTEGER" property="rate"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`mch_id`,`parent_mch_id`,`api_key`,`notify_url`,`cert_path`,`type` | |||
| `id`,`mch_id`,`parent_mch_id`,`api_key`,`notify_url`,`cert_path`,`type`,`share`,`rate` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -42,7 +44,13 @@ | |||
| and `cert_path` like concat('%', #{certPath},'%') | |||
| </if> | |||
| <if test=" null != type "> | |||
| and `type` like concat('%', #{type},'%') | |||
| and `type` = #{type} | |||
| </if> | |||
| <if test=" null != share "> | |||
| and `share` = #{share} | |||
| </if> | |||
| <if test=" null != rate "> | |||
| and `rate` = #{rate} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| @@ -17,11 +17,13 @@ | |||
| <result column="pay_vendor" jdbcType="INTEGER" property="payVendor"/> | |||
| <result column="pay_order_no" jdbcType="VARCHAR" property="payOrderNo"/> | |||
| <result column="pay_order_status" jdbcType="INTEGER" property="payOrderStatus"/> | |||
| <result column="share" jdbcType="INTEGER" property="share"/> | |||
| <result column="share_amount" jdbcType="INTEGER" property="shareAmount"/> | |||
| <result column="fail_reason" jdbcType="VARCHAR" property="failReason"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`create_time`,`update_time`,`order_id`,`c_user_id`,`ip`,`pay_amount`,`pay_time_start`,`pay_time_end`,`prepay_id`,`transaction_id`,`pay_vendor`,`pay_order_no`,`pay_order_status`,`fail_reason` | |||
| `id`,`tenant_id`,`create_time`,`update_time`,`order_id`,`c_user_id`,`ip`,`pay_amount`,`pay_time_start`,`pay_time_end`,`prepay_id`,`transaction_id`,`pay_vendor`,`pay_order_no`,`pay_order_status`,`share`,`share_amount`,`fail_reason` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -86,7 +88,12 @@ | |||
| <if test=" null != payOrderStatus "> | |||
| and `pay_order_status` = #{payOrderStatus} | |||
| </if> | |||
| <if test=" null != share "> | |||
| and `share` = #{share} | |||
| </if> | |||
| <if test=" null != shareAmount "> | |||
| and `share_amount` = #{shareAmount} | |||
| </if> | |||
| <if test=" null != failReason "> | |||
| and `fail_reason` like concat('%', #{failReason},'%') | |||
| </if> | |||
| @@ -0,0 +1,50 @@ | |||
| <?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.WxRentContractMapper"> | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxRentContract"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||
| <result column="price" jdbcType="DECIMAL" property="price" /> | |||
| <result column="rental_start_date" jdbcType="TIMESTAMP" property="rentalStartDate" /> | |||
| <result column="rental_end_date" jdbcType="TIMESTAMP" property="rentalEndDate" /> | |||
| <result column="sign_date" jdbcType="TIMESTAMP" property="signDate" /> | |||
| <result column="pay_area" jdbcType="DECIMAL" property="payArea" /> | |||
| <result column="receive_period" jdbcType="INTEGER" property="receivePeriod" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`merchant_id`,`price`,`rental_start_date`,`rental_end_date`,`sign_date`,`pay_area`,`receive_pay` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> and `id` = #{id} </if> | |||
| <if test=" null != merchantId "> and `merchant_id` = #{merchantId} </if> | |||
| <if test=" null != price "> and `price` = #{price} </if> | |||
| <if test=" null != rentalStartDate "> and `rental_start_date` = #{rentalStartDate} </if> | |||
| <if test=" null != rentalEndDate "> and `rental_end_date` = #{rentalEndDate} </if> | |||
| <if test=" null != signDate "> and `sign_date` = #{signDate} </if> | |||
| <if test=" null != payArea "> and `pay_area` = #{payArea} </if> | |||
| <if test=" null != receivePeriod "> and `receive_period` = #{receivePeriod} </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.WxRentContract" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_rent_contract | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="findObjectByMerchantId" resultMap="BaseResultMap"> | |||
| select * from wx_rent_contract where merchant_id=#{value} | |||
| </select> | |||
| </mapper> | |||
| @@ -127,8 +127,10 @@ | |||
| select s.id,s.shop_number shopNumber,s.build_area buildArea, | |||
| s.img_url imgUrl,s.operation_area operationArea, | |||
| s.status,b.building_name building,f.floor_name floor | |||
| from wx_shop s left join wx_mall_building b | |||
| s.status,b.building_name building,f.floor_name floor,m.`name` merchantName | |||
| from wx_shop s inner join wx_merchant_shop ms on ms.shop_id=s.id and ms.is_del=0 | |||
| inner join wx_merchant m on ms.merchant_id=m.id | |||
| left join wx_mall_building b | |||
| on s.building=b.id | |||
| left join wx_mall_floor f on s.floor=f.id | |||
| where 1 = 1 | |||
| @@ -224,5 +226,18 @@ | |||
| </select> | |||
| <select id="getbshoplist" resultType="hashmap" parameterType="hashmap"> | |||
| select id,shop_number shopNumber from wx_shop | |||
| where tenant_id=#{tenantId} and shop_number like concat('%', ${shopNumber},'%') | |||
| </select> | |||
| <select id="getMerchantShopByShopId" resultType="hashmap" parameterType="hashmap"> | |||
| select m.`name` merchantName,s.build_area buildArea,s.operation_area operationArea, | |||
| c.price,c.receive_period receivePeriod | |||
| from wx_merchant_shop ms inner join wx_merchant m on ms.merchant_id=m.id | |||
| inner join wx_shop s on ms.shop_id=s.id | |||
| inner join wx_rent_contract c on ms.merchant_id=c.merchant_id | |||
| where ms.tenant_id=${tenantId} and ms.shop_id=${shopId} and ms.is_del=0 | |||
| </select> | |||
| </mapper> | |||
| @@ -28,6 +28,18 @@ | |||
| <weixin-java-miniapp.version>3.1.0</weixin-java-miniapp.version> | |||
| </properties> | |||
| <dependencyManagement> | |||
| <dependencies> | |||
| <dependency> | |||
| <groupId>com.amazonaws</groupId> | |||
| <artifactId>aws-java-sdk-bom</artifactId> | |||
| <version>1.11.404</version> | |||
| <type>pom</type> | |||
| <scope>import</scope> | |||
| </dependency> | |||
| </dependencies> | |||
| </dependencyManagement> | |||
| <dependencies> | |||
| <dependency> | |||
| <groupId>org.springframework.boot</groupId> | |||
| @@ -228,9 +240,6 @@ | |||
| <version>${weixin-java-miniapp.version}</version> | |||
| </dependency> | |||
| </dependencies> | |||
| <build> | |||
| <plugins> | |||