| @@ -13,7 +13,6 @@ import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.enums.EnumDelFlag; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.service.WxBrandService; | |||
| import com.iformall.service.WxMerchantService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| @@ -37,8 +36,6 @@ public class WxBrandController extends BaseController { | |||
| @Autowired | |||
| private WxBrandService wxBrandService; | |||
| @Autowired | |||
| private WxMerchantService wxMerchantService; | |||
| @GetMapping("list") | |||
| @@ -82,10 +79,6 @@ public class WxBrandController extends BaseController { | |||
| wxMerchant.setIsDel(EnumYesOrNo.NO.getCode()); | |||
| wxMerchant.setBrand(wxBrand.getId()); | |||
| List<WxMerchant> merchantList = wxMerchantService.findList(wxMerchant); | |||
| if(CollectionUtils.isNotEmpty(merchantList)){ | |||
| return new ResultData(Result.ERROR, "请先删除已绑定该品牌的商户。"); | |||
| } | |||
| } | |||
| wxBrandService.update(wxBrand); | |||
| return new ResultData(Result.SUCCESS, "操作成功"); | |||
| @@ -1,445 +0,0 @@ | |||
| package com.iformall.controller.basic; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.annotation.TenantIgnore; | |||
| import com.iformall.annotation.UserDataRuleAnnotation; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxPayAccount; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxProfitSharingReceiver; | |||
| import com.iformall.domain.vo.WxMerchantTradeDetailVo; | |||
| import com.iformall.domain.vo.WxMerchantTradeVo; | |||
| import com.iformall.domain.vo.WxMerchantVo; | |||
| import com.iformall.douyin.pay.enums.AppAddSubMerchantUrlType; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.Constant; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @RestController | |||
| @RequestMapping("wxMerchant") | |||
| public class WxMerchantController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxMerchantService wxMerchantService; | |||
| @Autowired | |||
| private QrCodeService qrCodeService; | |||
| @Autowired | |||
| private WxAppinfoService wxAppinfoService; | |||
| @Autowired | |||
| private WxPayAccountService payAccountService; | |||
| @Autowired | |||
| private WxProfitSharingReceiverService wxProfitSharingReceiverService; | |||
| @UserDataRuleAnnotation("merchant_list") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("listVo") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| @SystemControllerLog(description = "商户-列表") | |||
| public ResultData listVo(@ModelAttribute WxMerchant wxMerchant, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::list"); | |||
| if (null == wxMerchant) wxMerchant = new WxMerchant(); | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| wxMerchant.setSortColumns(BaseEntity.SortField.TopTime_DESC); | |||
| wxMerchant.setIsPrivate(EnumYesOrNo.NO.getCode()); | |||
| final PageInfo<WxMerchant> page = wxMerchantService.listVoAsPage(wxMerchant, pageNum, pageSize,true); | |||
| return new ResultData(page); | |||
| } | |||
| @UserDataRuleAnnotation("merchant_list") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("listVo2") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| @SystemControllerLog(description = "商户-列表") | |||
| public ResultData listVo2(@ModelAttribute WxMerchant wxMerchant, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::list"); | |||
| if (null == wxMerchant) wxMerchant = new WxMerchant(); | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| wxMerchant.setSortColumns(BaseEntity.SortField.TopTime_DESC); | |||
| wxMerchant.setIsPrivate(EnumYesOrNo.NO.getCode()); | |||
| final PageInfo<WxMerchant> page = wxMerchantService.listVoAsPage(wxMerchant, pageNum, pageSize,false); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||
| }) | |||
| @SystemControllerLog(description = "商户-列表") | |||
| public ResultData list(@ModelAttribute WxMerchant wxMerchant, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::list"); | |||
| if (null == wxMerchant) wxMerchant = new WxMerchant(); | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| wxMerchant.setSortColumns(BaseEntity.SortField.TopTime_DESC); | |||
| wxMerchant.setIsPrivate(EnumYesOrNo.NO.getCode()); | |||
| final PageInfo<WxMerchant> page = wxMerchantService.listAsPage(wxMerchant, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @TenantIgnore | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("parentList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||
| }) | |||
| @SystemControllerLog(description = "商户-列表") | |||
| public ResultData parentList(@ModelAttribute WxMerchant wxMerchant, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::parentList"); | |||
| if (null == wxMerchant) wxMerchant = new WxMerchant(); | |||
| String tenantId = getUser().getTenantId(); | |||
| // wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| wxMerchant.setParentTenantId(tenantId); | |||
| wxMerchant.setSortColumns(BaseEntity.SortField.TopTime_DESC); | |||
| wxMerchant.setIsPrivate(EnumYesOrNo.NO.getCode()); | |||
| final PageInfo<WxMerchant> page = wxMerchantService.listAsPage(wxMerchant, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("获取商管商户") | |||
| @GetMapping("adminMerchantOne") | |||
| @SystemControllerLog(description = "商户-列表") | |||
| public ResultData adminMerchantOne() { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::adminMerchantOne"); | |||
| WxMerchant wxMerchant = new WxMerchant(); | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| wxMerchant.setStatus(EnumMerchantStatus.VALID.getCode()); | |||
| wxMerchant.setIsAdmin(EnumMerchantAdmin.PUBLIC_ADMIN.getCode()); | |||
| wxMerchant.setSortColumns(BaseEntity.SortField.TopTime_DESC); | |||
| List<WxMerchant> list = wxMerchantService.findList(wxMerchant); | |||
| if(list == null || list.isEmpty()){ | |||
| return new ResultData(ErrorCode.SYS_NULLPOINTER_ERROR.getCode(),"未找到商管商户"); | |||
| } | |||
| return new ResultData(list.get(0)); | |||
| } | |||
| @ApiOperation("获取商户ID,名称接口") | |||
| @GetMapping("IdAndNamelist") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "type", value = "类型", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true) | |||
| }) | |||
| @SystemControllerLog(description = "商户-列表") | |||
| public ResultData IdAndNamelist(Integer type,Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::list"); | |||
| WxMerchant wxMerchant = new WxMerchant(); | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| wxMerchant.setSortColumns(BaseEntity.SortField.TopTime_DESC); | |||
| wxMerchant.setStatus(EnumMerchantStatus.VALID.getCode()); | |||
| wxMerchant.setType(type); | |||
| wxMerchant.setCarVendorType(0); | |||
| return new ResultData(wxMerchantService.queryIdAndNames(wxMerchant)); | |||
| } | |||
| @ApiOperation("ETCP商户列表") | |||
| @GetMapping("etcplist") | |||
| @SystemControllerLog(description = "商户-ETCP商户列表") | |||
| public ResultData etcpList(@ModelAttribute WxMerchant wxMerchant) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::etcpList"); | |||
| if (null == wxMerchant) wxMerchant = new WxMerchant(); | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| final List<WxMerchant> merchantList = wxMerchantService.etcpList(wxMerchant); | |||
| return new ResultData(merchantList); | |||
| } | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| @SystemControllerLog(description = "商户-删除") | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::delete"); | |||
| wxMerchantService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| @SystemControllerLog(description = "商户-查询") | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::findById"); | |||
| WxMerchant wxMerchant = wxMerchantService.getById(id); | |||
| return new ResultData(wxMerchant); | |||
| } | |||
| @ApiOperation("停用") | |||
| @GetMapping("disable") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| @SystemControllerLog(description = "商户-停用") | |||
| public ResultData disable(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::disable"); | |||
| wxMerchantService.disable(id); | |||
| return new ResultData(Result.SUCCESS, "停用成功"); | |||
| } | |||
| @ApiOperation("新增商户接口") | |||
| @PostMapping("addMerchant") | |||
| @SystemControllerLog(description = "商户-新增") | |||
| public ResultData addMerchant(@RequestBody WxMerchant wxMerchant) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::addMerchant"); | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| ResultData resultData = wxMerchantService.addMerchant(wxMerchant, getUserId()); | |||
| if(resultData.code == 200){ | |||
| wxMerchantService.updateQrCode(wxMerchant,wxMerchant.getId()); | |||
| } | |||
| return resultData; | |||
| } | |||
| @ApiOperation("更新商户接口") | |||
| @PostMapping("updateMerchant") | |||
| @SystemControllerLog(description = "商户-更新") | |||
| public ResultData updateMerchant(@RequestBody WxMerchant wxMerchant) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::updateMerchant"); | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| return wxMerchantService.updateMerchant(wxMerchant); | |||
| } | |||
| // @ApiOperation("更新账户接口") | |||
| // @PostMapping("updateMerchantAccount") | |||
| // @SystemControllerLog(description = "商户-更新账户") | |||
| // public ResultData updateMerchantAccount(@RequestBody WxMerchant wxMerchant) { | |||
| // logger.debug("[" + getIpAddr() + "] WxMerchantController::updateMerchantAccount"); | |||
| // wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| // return wxMerchantService.updateMerchantAccount(wxMerchant,EnumPayWay.PAY_WAY_WECHAT); | |||
| // } | |||
| @ApiOperation("更新管理员接口") | |||
| @PostMapping("updateMerchantAdmin") | |||
| @SystemControllerLog(description = "商户-更新管理员") | |||
| public ResultData updateMerchantAdmin(@RequestBody WxMerchant wxMerchant) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::updateMerchantAdmin"); | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| return wxMerchantService.updateMerchantAdmin(wxMerchant); | |||
| } | |||
| @ApiOperation("更新法人接口") | |||
| @PostMapping("updateMerchantCorp") | |||
| @SystemControllerLog(description = "商户-更新法人") | |||
| public ResultData updateMerchantCopr(@RequestBody WxMerchant wxMerchant) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::updateMerchantCorp"); | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| return wxMerchantService.updateMerchantCorp(wxMerchant); | |||
| } | |||
| @ApiOperation("更新税务接口") | |||
| @PostMapping("updateMerchantTax") | |||
| @SystemControllerLog(description = "商户-更新税务") | |||
| public ResultData updateMerchantTax(@RequestBody WxMerchant wxMerchant) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::updateMerchantTax"); | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| return wxMerchantService.updateMerchantTax(wxMerchant); | |||
| } | |||
| @ApiOperation("商户信息设置接口") | |||
| @PostMapping("updateMerchantLevel") | |||
| @SystemControllerLog(description = "商户-更新会员等级权益") | |||
| public ResultData updateMerchantLevel(@RequestBody WxMerchant wxMerchant) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::updateMerchantLevel"); | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| return wxMerchantService.updateMerchantLevel(wxMerchant); | |||
| } | |||
| @ApiOperation("查询当前租户下商户名称列表") | |||
| @GetMapping("/name_list") | |||
| @SystemControllerLog(description = "查询当前租户下商户名称列表") | |||
| public ResultData nameList() { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::name_list"); | |||
| return new ResultData(wxMerchantService.findList(getTenantInfo())); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findMerchantById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| @SystemControllerLog(description = "商户-查询") | |||
| public ResultData findMerchantById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::findMerchantById"); | |||
| WxMerchantVo wxMerchant = wxMerchantService.findMerchantById(getTenantInfo(),id); | |||
| return new ResultData(wxMerchant); | |||
| } | |||
| @UserDataRuleAnnotation("merchant_list") | |||
| @ApiOperation("商户数据导出") | |||
| @GetMapping("/exportData") | |||
| @SystemControllerLog(description = "商户-商户数据导出") | |||
| public void exportData(@ModelAttribute WxMerchant wxMerchant, HttpServletRequest request, HttpServletResponse response) { | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| wxMerchant.setSortColumns(BaseEntity.SortField.TopTime_DESC); | |||
| wxMerchant.setIsPrivate(EnumYesOrNo.NO.getCode()); | |||
| wxMerchantService.exportData(wxMerchant,request,response); | |||
| } | |||
| @ApiOperation("置顶") | |||
| @PostMapping("top") | |||
| @SystemControllerLog(description = "商户-置顶") | |||
| public ResultData top(@RequestBody WxMerchant wxMerchant) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::top"); | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| return wxMerchantService.top(wxMerchant); | |||
| } | |||
| // @ApiOperation("更新收款账户状态") | |||
| // @PostMapping("useAccount") | |||
| // @SystemControllerLog(description = "商户-更新收款账户状态") | |||
| // public ResultData useAccount(@RequestBody WxProfitSharingReceiver wxProfitSharingReceiver) { | |||
| // logger.debug("[" + getIpAddr() + "] WxMerchantController::useAccount"); | |||
| // wxProfitSharingReceiver.updateTenantInfo(getTenantInfo()); | |||
| // return wxMerchantService.useAccount(wxProfitSharingReceiver); | |||
| // } | |||
| @ApiOperation("查看是否存在商户名称相同记录") | |||
| @GetMapping("/hasMerchant") | |||
| @SystemControllerLog(description = "商户-查看是否存在商户名称相同记录") | |||
| public ResultData hasMerchant(@ModelAttribute WxMerchant wxMerchant) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::hasMerchant"); | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| boolean has = wxMerchantService.hasMerchant(wxMerchant); | |||
| return new ResultData(has); | |||
| } | |||
| @ApiOperation("查看是否存在商户名称相同记录") | |||
| @GetMapping("/hasMerchantEncode") | |||
| @SystemControllerLog(description = "商户-查看是否存在商户编码相同记录") | |||
| @TenantIgnore | |||
| public ResultData hasMerchantEncode(@ModelAttribute WxMerchant wxMerchant) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::hasMerchantEncode{}"+wxMerchant.toString()); | |||
| boolean has = wxMerchantService.hasMerchantEncode(wxMerchant); | |||
| return new ResultData(has); | |||
| } | |||
| @ApiOperation("商户会员消费分页列表接口") | |||
| @GetMapping("userTradeList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| @SystemControllerLog(description = "商户-消费列表") | |||
| public ResultData userTradeList(@ModelAttribute WxMerchant wxMerchant, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::list"); | |||
| if (null == wxMerchant) wxMerchant = new WxMerchant(); | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| wxMerchant.setSortColumns(BaseEntity.SortField.TopTime_DESC); | |||
| final PageInfo<WxMerchantTradeVo> page = wxMerchantService.userTradeList(wxMerchant, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("商户会员消费明细列表接口") | |||
| @GetMapping("userTradeDetailList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| @SystemControllerLog(description = "商户-商户会员消费明细列表接口") | |||
| public ResultData userTradeDetailList(@ModelAttribute WxMerchant wxMerchant, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::list"); | |||
| if (null == wxMerchant) wxMerchant = new WxMerchant(); | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| final PageInfo<WxMerchantTradeDetailVo> page = wxMerchantService.userTradeDetailList(wxMerchant, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("导出商户会员消费分页列表") | |||
| @GetMapping("exportUserTradeDetailList") | |||
| @SystemControllerLog(description = "导出商户会员消费分页列表") | |||
| public void exportUserTradeList(@ModelAttribute WxMerchant wxMerchant,HttpServletRequest request, HttpServletResponse response) throws Exception{ | |||
| logger.debug("[" + getIpAddr() + "] WxBusinessController::exportUserTradeDetailList"); | |||
| if (null == wxMerchant) wxMerchant = new WxMerchant(); | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| wxMerchantService.exportUserTradeList(wxMerchant, request,response); | |||
| } | |||
| @ApiOperation("刷新进件页面") | |||
| @GetMapping("/updateTtReceiver") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| @SystemControllerLog(description = "商户-删除") | |||
| public ResultData updateTtReceiver(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::updateTtReceiver"); | |||
| WxMerchant merchant = wxMerchantService.selectById(id); | |||
| if(merchant == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | |||
| } | |||
| return wxProfitSharingReceiverService.updateTtReceiver(merchant); | |||
| } | |||
| @ApiOperation("获取进件/余额页面") | |||
| @GetMapping("/getTtReceiverUrl") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData getTtReceiver(Long id,Integer urlType) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::getTtReceiver"); | |||
| if(urlType == null || id == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"请检查传递参数"); | |||
| } | |||
| WxMerchant merchant = wxMerchantService.selectById(id); | |||
| if(merchant == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | |||
| } | |||
| AppAddSubMerchantUrlType anEnum = AppAddSubMerchantUrlType.getEnum(urlType); | |||
| if(anEnum == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | |||
| } | |||
| if(anEnum.equals(AppAddSubMerchantUrlType.improt_URL)){ | |||
| return wxProfitSharingReceiverService.getTtReceiverImprotURL(merchant); | |||
| }else if(anEnum.equals(AppAddSubMerchantUrlType.Balance_URL)){ | |||
| return wxProfitSharingReceiverService.getTtReceiverBalanceURL(merchant); | |||
| }else{ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | |||
| } | |||
| } | |||
| @ApiOperation("修改可用状态") | |||
| @GetMapping("/updateTtReceiverIsUse") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| @SystemControllerLog(description = "商户-删除") | |||
| public ResultData updateTtReceiverIsUse(Long id) { | |||
| WxMerchant merchant = wxMerchantService.selectById(id); | |||
| if(merchant == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | |||
| } | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(getTenantInfo(), EnumAppPlat.TOUTIAO); | |||
| if(appInfo == null) { | |||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||
| } | |||
| WxPayAccount payAcount = payAccountService.getById(appInfo.getPayId()); | |||
| if(payAcount == null){ | |||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||
| } | |||
| return wxProfitSharingReceiverService.updateTtReceiverIsUse(merchant); | |||
| } | |||
| } | |||
| @@ -1,130 +0,0 @@ | |||
| package com.iformall.controller.basic; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.annotation.TenantIgnore; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxProfitSharingReceiver; | |||
| import com.iformall.domain.po.WxProfitSharingReceiverApply; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxMerchantReceiverApplyVo; | |||
| import com.iformall.douyin.pay.enums.MerchantImportStatus; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.file.aliyun.AliyunOSS; | |||
| import com.iformall.service.WxMerchantService; | |||
| import com.iformall.service.WxProfitSharingReceiverApplyService; | |||
| import com.iformall.service.WxProfitSharingReceiverService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.apache.commons.codec.binary.Base64; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.io.ByteArrayInputStream; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("sharingReceiverApply") | |||
| @Api(description = "进件相关接口") | |||
| @Slf4j | |||
| public class WxProfitSharingReceiverApplyController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxProfitSharingReceiverApplyService wxProfitSharingReceiverApplyService; | |||
| @Autowired | |||
| private WxProfitSharingReceiverService wxProfitSharingReceiverService; | |||
| @Autowired | |||
| private WxMerchantService wxMerchantService; | |||
| @Autowired | |||
| private AliyunOSS aliyunOSS; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("listVo") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||
| }) | |||
| @SystemControllerLog(description = "商户-列表") | |||
| public ResultData listVo(WxMerchantReceiverApplyVo receiver, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::listVo"); | |||
| if (null == receiver) receiver = new WxMerchantReceiverApplyVo(); | |||
| receiver.updateTenantInfo(getTenantInfo()); | |||
| final PageInfo<WxMerchantReceiverApplyVo> page = wxProfitSharingReceiverApplyService.listVoAsPage(receiver, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @TenantIgnore | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("tenantListVo") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||
| }) | |||
| @SystemControllerLog(description = "商户-列表") | |||
| public ResultData tenantListVo(WxMerchantReceiverApplyVo receiver, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::tenantListVo"); | |||
| if (null == receiver) receiver = new WxMerchantReceiverApplyVo(); | |||
| final PageInfo<WxMerchantReceiverApplyVo> page = wxProfitSharingReceiverApplyService.listVoAsPage(receiver, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @TenantIgnore | |||
| @ApiOperation("修改功能状态") | |||
| @PostMapping("/updateFunctionState") | |||
| @SystemControllerLog(description = "修改") | |||
| public ResultData updateFunctionState(@RequestBody WxProfitSharingReceiverApply receiverAdd) { | |||
| log.debug("[" + getIpAddr() + "] merchantProfitSharingReceiver::updateFunctionState"); | |||
| if(receiverAdd.getId() == null || receiverAdd.getFunctionState() == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| WxProfitSharingReceiverApply receiverApply = wxProfitSharingReceiverApplyService.selectById(receiverAdd.getId()); | |||
| if(receiverApply == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未找到进件数据"); | |||
| } | |||
| if(!EnumSharingReceiverApplymentState.APPLYMENT_STATE_FINISHED.getCode().equals(receiverApply.getApplymentState())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "进件还未完成"); | |||
| } | |||
| receiverAdd.updateTenantInfo(receiverApply); | |||
| return wxProfitSharingReceiverApplyService.updateFunctionState(receiverAdd); | |||
| } | |||
| @TenantIgnore | |||
| @ApiOperation("刷新审核状态") | |||
| @GetMapping("/syncApplymentStates") | |||
| @SystemControllerLog(description = "刷新") | |||
| public ResultData syncApplymentStates(Long id) { | |||
| log.debug("[" + getIpAddr() + "] merchantProfitSharingReceiver::syncApplymentStates"); | |||
| if(id == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "ID不能为空"); | |||
| } | |||
| WxProfitSharingReceiverApply receiverApply = wxProfitSharingReceiverApplyService.findResultStateById(id); | |||
| if(receiverApply == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未找到进件数据"); | |||
| } | |||
| return wxProfitSharingReceiverApplyService.handApplymentStates(receiverApply); | |||
| } | |||
| } | |||
| @@ -1,104 +0,0 @@ | |||
| package com.iformall.controller.market; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.po.base.BaseEntity.SortField; | |||
| import com.iformall.enums.EnumCashOutStatus; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.service.*; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import java.util.ArrayList; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| /** | |||
| * 提现。微信需要小程序开通“企业付款到零钱”功能。 | |||
| * @author alascor | |||
| * | |||
| */ | |||
| @RestController | |||
| @RequestMapping("/cashout") | |||
| @Api(description = "提现相关接口") | |||
| public class WxCashOutController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCashOutService wxCashOutService; | |||
| @Autowired | |||
| WxCUserService wxCUserService; | |||
| @Autowired | |||
| WxMerchantService wxMerchantService; | |||
| @Autowired | |||
| WxMallService wxMallService; | |||
| @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 WxCashOut wxCashOut, Integer pageNum, Integer pageSize) { | |||
| if (null == wxCashOut) wxCashOut = new WxCashOut(); | |||
| TenantEntity tenantInfo = getTenantInfo(); | |||
| wxCashOut.updateTenantInfo(tenantInfo); | |||
| if (null != wxCashOut.getStatus() && wxCashOut.getStatus().intValue()>0) { | |||
| //提现中 | |||
| List<Integer> statusList = new ArrayList<Integer>(); | |||
| if (wxCashOut.getStatus().intValue()==99) { | |||
| statusList.add(EnumCashOutStatus.DOING.getCode()); | |||
| statusList.add(EnumCashOutStatus.WAITING.getCode()); | |||
| wxCashOut.setStatusList(statusList); | |||
| wxCashOut.setStatus(null); | |||
| //提现成功 | |||
| }else if (wxCashOut.getStatus().intValue()==98) { | |||
| statusList.add(EnumCashOutStatus.SUCCESS.getCode()); | |||
| wxCashOut.setStatusList(statusList); | |||
| wxCashOut.setStatus(null); | |||
| //提现失败 | |||
| }else if (wxCashOut.getStatus().intValue()==97) { | |||
| statusList.add(EnumCashOutStatus.FAIL.getCode()); | |||
| statusList.add(EnumCashOutStatus.BACK.getCode()); | |||
| wxCashOut.setStatusList(statusList); | |||
| wxCashOut.setStatus(null); | |||
| //提现拒绝 | |||
| }else if (wxCashOut.getStatus().intValue()==96) { | |||
| statusList.add(EnumCashOutStatus.REJECT.getCode()); | |||
| wxCashOut.setStatusList(statusList); | |||
| wxCashOut.setStatus(null); | |||
| //审批中 | |||
| }else if (wxCashOut.getStatus().intValue()==95) { | |||
| statusList.add(EnumCashOutStatus.AUDIOING.getCode()); | |||
| wxCashOut.setStatusList(statusList); | |||
| wxCashOut.setStatus(null); | |||
| } | |||
| }else { | |||
| wxCashOut.setStatus(null); | |||
| } | |||
| wxCashOut.setSortColumns(SortField.CreateDate_DESC); | |||
| final PageInfo<WxCashOut> page = wxCashOutService.listAsPage(wxCashOut, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("查询当前提现信息") | |||
| @GetMapping("getInfo") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "id", value = "主键id", dataType = "Long", paramType = "query", required = true)}) | |||
| public ResultData getCurrentCashOutData(Long id) { | |||
| TenantEntity tenantInfo = getTenantInfo(); | |||
| WxCashOut out = wxCashOutService.getById(id, tenantInfo.getTenantId()); | |||
| return new ResultData(out); | |||
| } | |||
| } | |||
| @@ -1,200 +0,0 @@ | |||
| package com.iformall.controller.mem; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.annotation.TenantIgnore; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxCreditHistory; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.MerchantCreditRankingVo; | |||
| import com.iformall.domain.vo.WxCreditHistoryVo; | |||
| import com.iformall.enums.EnumMerchantStatus; | |||
| import com.iformall.enums.EnumScoreType; | |||
| import com.iformall.enums.EnumUserType; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.WxCreditHistoryService; | |||
| import com.iformall.service.WxMerchantService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.Map; | |||
| import java.util.Objects; | |||
| @RestController | |||
| @RequestMapping("wxCreditHistory") | |||
| public class WxCreditHistoryController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| WxCreditHistoryService wxCreditHistoryService; | |||
| @Autowired | |||
| private WxMerchantService wxMerchantService; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| @SystemControllerLog(description = "积分历史-列表") | |||
| public ResultData list(@ModelAttribute WxCreditHistory wxCreditHistory, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::list"); | |||
| if (null == wxCreditHistory) wxCreditHistory = new WxCreditHistory(); | |||
| TenantEntity tenantInfo = getTenantInfo(); | |||
| wxCreditHistory.updateTenantInfo(tenantInfo); | |||
| final PageInfo<WxCreditHistoryVo> page = wxCreditHistoryService.listAsPageMore(wxCreditHistory, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("根据商户ID和消费金额获取所增加积分 取data里credit的值") | |||
| @GetMapping("findByMerchantIdAndSpend") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "merchantId", value = "商户ID", dataType = "long", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "spend", value = "消费金额", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "userId", value = "会员Id", dataType = "long", paramType = "query", required = true)}) | |||
| @SystemControllerLog(description = "积分历史-根据商户ID和消费金额获取所增加积分") | |||
| public ResultData findByMerchantIdAndSpend(Long merchantId, String spendStr,Long userId) { | |||
| logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::findByMerchantIdAndSpend"); | |||
| if(Objects.isNull(merchantId)|| StringUtils.isEmpty(spendStr)||Objects.isNull(userId)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL) ; | |||
| } | |||
| try { | |||
| Map<String, Integer> result = wxCreditHistoryService.findByMerchantIdAndSpend(merchantId, spendStr, userId) ; | |||
| return new ResultData(result); | |||
| } catch (MallinkException e) { | |||
| return new ResultData(e.getErrorCode(),e.getMessage()); | |||
| } catch (Exception e) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,e.getMessage()); | |||
| } | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| @SystemControllerLog(description = "积分历史-新增接口") | |||
| public ResultData add(@RequestBody WxCreditHistory wxCreditHistory) { | |||
| logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::add"); | |||
| MallUserInfo user = getUser(); | |||
| wxCreditHistory.setTenantId(user.getFinalTenantId()); | |||
| wxCreditHistory.setFinalTenantId(user.getFinalTenantId()); | |||
| wxCreditHistory.setOperatorId(user.getId()); | |||
| wxCreditHistory.setOperatorType(EnumUserType.MALLUSER.getCode()); | |||
| String desc = ""; | |||
| if(wxCreditHistory.getCreditType().equals(EnumScoreType.SPEND_CREDIT.getCode())){ | |||
| WxMerchant byId = wxMerchantService.getById(wxCreditHistory.getMerchantId()); | |||
| desc = "管理端手动积分:消费商户["+byId.getName()+"] 消费金额["+wxCreditHistory.getSpendStr()+"元]"; | |||
| }else if(wxCreditHistory.getCreditType().equals(EnumScoreType.REDUCE_CREDIT.getCode())){ | |||
| desc = "管理端手动扣减积分"; | |||
| if(StringUtils.isNotBlank(wxCreditHistory.getChangePurpose())){ | |||
| desc = desc + "["+wxCreditHistory.getChangePurpose()+"]"; | |||
| } | |||
| }else{ | |||
| desc = "管理端("+user.getUsername()+")操作未知积分来源"; | |||
| } | |||
| wxCreditHistory.setChangePurpose(desc); | |||
| try { | |||
| wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),getTenantInfo()) ; | |||
| WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory,getTenantInfo().getTenantId()); | |||
| return new ResultData(Result.SUCCESS, "操作成功", credit); | |||
| } catch (MallinkException e) { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| @SystemControllerLog(description = "积分历史-查询") | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxCreditHistoryService.getById(id,getTenantInfo().getFinalTenantId())); | |||
| } | |||
| /** | |||
| * 根据A端设置的【每自然年末扣除前N年用户积分】规则,扣减用户积分 | |||
| * | |||
| * @return | |||
| */ | |||
| public ResultData clearCreditByYear() { | |||
| logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::clearCreditByYear"); | |||
| wxCreditHistoryService.clearCreditByYear(); | |||
| return new ResultData(Result.SUCCESS); | |||
| } | |||
| @GetMapping("exportData") | |||
| @SystemControllerLog(description = "积分历史-导出数据") | |||
| public void exportData(@ModelAttribute WxCreditHistory wxCreditHistory, HttpServletRequest request, HttpServletResponse response) { | |||
| wxCreditHistory.setTenantId(getTenantInfo().getFinalTenantId()); | |||
| wxCreditHistory.setFinalTenantId(getTenantInfo().getFinalTenantId()); | |||
| wxCreditHistoryService.exportData(request, response, wxCreditHistory); | |||
| } | |||
| @ApiOperation("积分统计概览") | |||
| @GetMapping("getCreditSummary") | |||
| @SystemControllerLog(description = "积分历史-积分统计概览") | |||
| public ResultData getCreditSummary(@ModelAttribute WxCreditHistory wxCreditHistory) { | |||
| logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::getCreditSummary"); | |||
| TenantEntity tenantInfo = getTenantInfo(); | |||
| wxCreditHistory.updateTenantInfo(tenantInfo); | |||
| return wxCreditHistoryService.getCreditSummary(wxCreditHistory); | |||
| } | |||
| @ApiOperation("积分清零计划") | |||
| @PostMapping("clearCreditByYear") | |||
| @SystemControllerLog(description = "积分清零计划") | |||
| @TenantIgnore | |||
| public ResultData clearCreditByYear(@RequestBody WxCreditHistory wxCreditHistory) { | |||
| logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::clearCreditByYear"); | |||
| if(wxCreditHistory == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL) ; | |||
| } | |||
| if(StringUtils.isBlank(wxCreditHistory.getFinalTenantId())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL) ; | |||
| } | |||
| wxCreditHistoryService.clearCreditByYear(wxCreditHistory); | |||
| return new ResultData(Result.SUCCESS); | |||
| } | |||
| @ApiOperation("积分清零计划 刷新商圈积分") | |||
| @PostMapping("syncClearCredit") | |||
| @SystemControllerLog(description = "刷新商圈积分") | |||
| @TenantIgnore | |||
| public ResultData syncClearCredit() { | |||
| logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::syncClearCredit"); | |||
| wxCreditHistoryService.syncClearCredit(getTenantInfo()); | |||
| return new ResultData(Result.SUCCESS); | |||
| } | |||
| @ApiOperation("门店排行榜") | |||
| @GetMapping("merchantCreditRanking") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| @SystemControllerLog(description = "、-列表") | |||
| public ResultData merchantCreditRanking(@ModelAttribute WxCreditHistory wxCreditHistory, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::merchantCreditRanking"); | |||
| if (null == wxCreditHistory) wxCreditHistory = new WxCreditHistory(); | |||
| TenantEntity tenantInfo = getTenantInfo(); | |||
| wxCreditHistory.updateTenantInfo(tenantInfo); | |||
| final PageInfo<MerchantCreditRankingVo> page = wxCreditHistoryService.listAsPageMcrv(wxCreditHistory, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| } | |||
| @@ -1,211 +0,0 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.WxMerchantDto; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxMerchantCorp; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxProfitSharingReceiver; | |||
| import com.iformall.domain.vo.WxMerchantSimpleVo; | |||
| import com.iformall.domain.vo.WxMerchantTradeDetailVo; | |||
| import com.iformall.domain.vo.WxMerchantTradeVo; | |||
| import com.iformall.domain.vo.WxMerchantVo; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import org.springframework.web.bind.annotation.ModelAttribute; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.Optional; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| public interface WxMerchantService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxMerchantTradeDetailVo> userTradeDetailList(WxMerchant record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxMerchantTradeVo> userTradeList(WxMerchant record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @return | |||
| */ | |||
| void exportUserTradeList(@ModelAttribute WxMerchant record, HttpServletRequest request, HttpServletResponse response); | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxMerchant> listAsPage(WxMerchant record, Integer pageIndex, Integer pageSize); | |||
| List<WxMerchant> queryIdAndNames(WxMerchant record); | |||
| Map<Long,String> getIdAndNamesMap(WxMerchant record); | |||
| PageInfo<WxMerchantVo> listAsPageCVo(WxMerchantDto wxMerchantDto, Integer pageIndex, Integer pageSize,boolean hasShop); | |||
| /** | |||
| * 根据code查询 | |||
| * | |||
| * @param params | |||
| * @return | |||
| */ | |||
| WxMerchantVo getMerchantInfo(HashMap<String, String> params); | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @return | |||
| */ | |||
| List<WxMerchant> etcpList(WxMerchant record); | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @return | |||
| */ | |||
| List<WxMerchant> findList(WxMerchant record); | |||
| /** | |||
| * 根据商管商户 | |||
| * | |||
| * @param tenantEntity | |||
| * @return | |||
| */ | |||
| List<WxMerchant> findAdminList(TenantEntity tenantEntity); | |||
| /** | |||
| * 查询商户列表 | |||
| * @param tenantEntity | |||
| * @return | |||
| */ | |||
| List<WxMerchantSimpleVo> findList(TenantEntity tenantEntity); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxMerchant selectById(Long id); | |||
| WxMerchant getById(Long id); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| void disable(Long id); | |||
| ResultData addMerchant(WxMerchant wxMerchant, Long userId); | |||
| /** | |||
| * 创建二维码 | |||
| */ | |||
| void updateQrCode(TenantEntity tenantEntity,Long merchantId); | |||
| ResultData updateMerchant(WxMerchant wxMerchant); | |||
| ResultData updateMerchantAccount(WxMerchant wxMerchant); | |||
| ResultData updateMerchantAdmin(WxMerchant wxMerchant); | |||
| ResultData updateMerchantCorp(WxMerchant wxMerchant); | |||
| ResultData updateMerchantTax(WxMerchant wxMerchant); | |||
| ResultData updateMerchantLevel(WxMerchant wxMerchant); | |||
| WxMerchantVo findMerchantById(TenantEntity tenantEntity,Long id); | |||
| WxMerchant findListOne(WxMerchant wxMerchant); | |||
| void exportData(WxMerchant wxMerchant, HttpServletRequest request, HttpServletResponse response); | |||
| ResultData top(WxMerchant wxMerchant); | |||
| // ResultData useAccount(WxProfitSharingReceiver wxProfitSharingReceiver); | |||
| boolean hasMerchant(WxMerchant wxMerchant); | |||
| boolean hasMerchantEncode(WxMerchant wxMerchant); | |||
| boolean hasMerchantBrand(WxMerchant wxMerchant); | |||
| boolean hasMerchantIsAdmin(WxMerchant wxMerchant); | |||
| WxMerchant getMerchantByEncode(String encode); | |||
| Optional<WxMerchant> findByName(String name); | |||
| PageInfo<WxMerchant> listVoAsPage(WxMerchant wxMerchant, Integer pageNum, Integer pageSize,boolean hasRentContractInfo); | |||
| List<WxMerchantVo> findMerchantVoList(Long couponId,TenantEntity tenantEntity,boolean hasShop); | |||
| Map<Long,List<WxMerchantVo>> findCouponMerchantVoList(List<Long> couponIds,TenantEntity tenantEntity,boolean hasShop); | |||
| Map<Long,String> getLiveCouponMerchantMap(List<Long> couponIds,TenantEntity tenantEntity); | |||
| List<WxMerchant> getMerchantList(WxMerchant wxMerchant); | |||
| void disableMerchat(Long id); | |||
| List<Long> getMerchantShopIds(Long merchantId); | |||
| ResultData damark(WxMerchant wxMerchant, TenantEntity tenantInfo); | |||
| ResultData downmark(WxMerchant wxMerchant); | |||
| ResultData markup(WxMerchant wxMerchant); | |||
| ResultData addttMerchant(WxMerchant wxMerchant, Long userId); | |||
| ResultData ttdisable(Long id); | |||
| ResultData ttstartusing(Long id); | |||
| @Deprecated | |||
| Map<String,Object> findMerchantByShop(Long shopId); | |||
| Map<String, Object> detailByShopId(TenantEntity tenantInfo, Long shopId); | |||
| List<Long> getFloorBuildMerchantIds(TenantEntity tenantEntity,String floorRule,Long building,Long floor,Integer merchantShopDel,Integer shopDel ) ; | |||
| List<WxMerchantVo> findMerchantListByProduct(TenantEntity tenantEntity,Long productId,boolean hasShop); | |||
| WxMerchantCorp getMerchantCorp(TenantEntity tenantInfo, Long id); | |||
| WxMerchant findAdmin(TenantEntity tenantEntity); | |||
| WxMerchant findBrandAdmin(TenantEntity tenantEntity, Long brandId); | |||
| Map<Long, WxMerchant> findMerchantMap(WxMerchant merchantQ); | |||
| } | |||
| @@ -40,9 +40,6 @@ public class OrderSnapshotServiceImpl implements OrderSnapshotService { | |||
| @Autowired | |||
| WxCouponMapper wxCouponMapper; | |||
| @Autowired | |||
| WxMerchantService wxMerchantService; | |||
| @Override | |||
| public ResultData getOrderSnapshotByOrderId(TenantEntity tenantEntity, Long orderId) { | |||
| OrderSnapshot os = new OrderSnapshot(); | |||
| @@ -70,54 +67,6 @@ public class OrderSnapshotServiceImpl implements OrderSnapshotService { | |||
| @Override | |||
| public void saveOrderSnapshot(WxOrder order) { | |||
| try{ | |||
| WxOrder wxOrder = wxOrderMapper.selectById(order.getId(), order.getTenantId()); | |||
| if(wxOrder == null){ | |||
| logger.error("同步订单快照异常---未找到订单数据"); | |||
| return ; | |||
| } | |||
| WxCoupon wxCoupon = wxCouponMapper.selectById(order.getProductId(),order.getTenantId()); | |||
| if(wxCoupon == null){ | |||
| logger.error("同步订单快照异常---未找到商品数据"); | |||
| return ; | |||
| } | |||
| WxCoupon attrsById = wxCouponMapper.getAttrsById(order.getProductId(), order.getTenantId()); | |||
| OrderSnapshot snapshot = new OrderSnapshot(); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| Date now = new Date(); | |||
| snapshot.updateTenantInfo(wxCoupon); | |||
| snapshot.setId(idWorker.nextId()); | |||
| snapshot.setComposeOrderId(wxOrder.getComposeOrderId()); | |||
| snapshot.setOrderId(wxOrder.getId()); | |||
| snapshot.initByCoupon(wxCoupon); | |||
| snapshot.setProductAttrs(attrsById.getProductAttrs()); | |||
| snapshot.setSkuAttrs(attrsById.getSkuAttrs()); | |||
| List<Long> couponIdList = new ArrayList<Long>(); | |||
| couponIdList.add(wxCoupon.getId()); | |||
| Map<Long, List<WxMerchantVo>> couponMerchantVoMap = wxMerchantService.findCouponMerchantVoList(couponIdList, wxCoupon,true); | |||
| List<WxMerchantVo> merchantList = couponMerchantVoMap.get(wxCoupon.getId()); | |||
| if (merchantList != null) { | |||
| merchantList = merchantList.stream().filter( | |||
| m->m.getMerchantStatus().equals(EnumMerchantStatus.VALID.getCode())) | |||
| .collect(Collectors.toList()); | |||
| } | |||
| snapshot.setMerchantList(JSON.toJSONString(merchantList)); | |||
| if(EnumCouponType.COUPON_GIFT.getCode().equals(wxCoupon.getType())){ | |||
| WxCoupon coupon = new WxCoupon(); | |||
| coupon.updateTenantInfo(wxCoupon); | |||
| List<Long> longs = JSON.parseArray(wxCoupon.getGiftList(), Long.class); | |||
| if(longs != null && longs.size() > 0){ | |||
| coupon.setIds(longs); | |||
| List<WxCoupon> giftList = wxCouponMapper.findList(coupon); | |||
| snapshot.setGiftList(JSON.toJSONString(giftList)); | |||
| } | |||
| } | |||
| snapshot.setCreateDate(now); | |||
| snapshot.setUpdateDate(now); | |||
| orderSnapshotMapper.insert(snapshot); | |||
| }catch(Exception e){ | |||
| logger.error("同步订单快照异常"+e.getMessage()); | |||
| @@ -88,9 +88,6 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||
| @Autowired | |||
| WxCouponMallService wxCouponMallService; | |||
| @Lazy | |||
| @Autowired | |||
| WxMerchantService wxMerchantService; | |||
| // @Override | |||
| // public ResultData couponList(TtCouponVo ttCouponVo, Integer pageNum, Integer pageSize) { | |||
| @@ -180,204 +177,10 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||
| return new ResultData(ErrorCode.COUPON_ORDER_IS_INVALID); | |||
| } | |||
| //获取门店,确保所有门店匹配poi | |||
| List<Long> merchantIds = null; | |||
| List<WxCouponMall> couponMallList = null; | |||
| if (EnumCouponType.isParentCoupon(coupon.getType())) { | |||
| WxCouponMall couponMall = new WxCouponMall(); | |||
| couponMall.updateTenantInfo(coupon); | |||
| couponMall.setProductId(coupon.getId()); | |||
| couponMall.setStatus(EnumCouponMallStatus.FINISED.getCode()); | |||
| couponMallList = wxCouponMallService.list(couponMall, false); | |||
| if (null == couponMallList || couponMallList.size() <= 0 ) { | |||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND.getCode(),"未完成设置关联商场"); | |||
| } | |||
| for (int i = 0 ; i < couponMallList.size(); i++ ) { | |||
| WxCouponMall cm = couponMallList.get(i); | |||
| List<Long> mchids = wxCouponMerchantMapper.findMerchantIdListByProduct(coupon.getId(), cm.getMallTenantId()); | |||
| if (null != mchids) { | |||
| if (null == merchantIds) { | |||
| merchantIds = new ArrayList<Long>(); | |||
| } | |||
| merchantIds.addAll(mchids); | |||
| } | |||
| //添加商管商户poi | |||
| TenantEntity mallTenantEntity = new TenantEntity(); | |||
| mallTenantEntity.setTenantId(cm.getMallTenantId()); | |||
| mallTenantEntity.setParentTenantId(coupon.getTenantId()); | |||
| WxMerchant adminMerchant = wxMerchantService.findAdmin(mallTenantEntity); | |||
| if (null == adminMerchant) { | |||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND.getCode(),"商场"+cm.getMallTenantId()+"未设置商管商户"); | |||
| } | |||
| if (!merchantIds.contains(adminMerchant.getId())){ | |||
| merchantIds.add(adminMerchant.getId()); | |||
| } | |||
| } | |||
| }else { | |||
| merchantIds = wxCouponMerchantMapper.findMerchantIdListByProduct(coupon.getId(), coupon.getTenantId()); | |||
| } | |||
| if (null == merchantIds || merchantIds.size() <= 0) { | |||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND.getCode(),"未设置商户"); | |||
| } | |||
| List<TtMerchantPoi> pois = null; | |||
| if (EnumCouponType.isParentCoupon(coupon.getType())) { | |||
| if (null == couponMallList || couponMallList.size() <= 0 ) { | |||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND.getCode(),"未完成设置关联商场"); | |||
| } | |||
| for (int i = 0 ; i < couponMallList.size(); i++ ) { | |||
| WxCouponMall cm = couponMallList.get(i); | |||
| TtMerchantPoi poiQ = new TtMerchantPoi(); | |||
| poiQ.setTenantId(cm.getMallTenantId()); | |||
| poiQ.setIds(merchantIds); | |||
| List<TtMerchantPoi> pois1 = ttMerchantPoiMapper.findList(poiQ); | |||
| if (null != pois1) { | |||
| if (null == pois) { | |||
| pois = new ArrayList<TtMerchantPoi>(); | |||
| } | |||
| pois.addAll(pois1); | |||
| } | |||
| } | |||
| }else { | |||
| TtMerchantPoi poiQ = new TtMerchantPoi(); | |||
| poiQ.updateTenantInfo(coupon); | |||
| poiQ.setIds(merchantIds); | |||
| pois = ttMerchantPoiMapper.findList(poiQ); | |||
| } | |||
| if(pois == null || pois.isEmpty()){ | |||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND.getCode(),"未找到poi门店"); | |||
| } | |||
| if(pois.size() != merchantIds.size()){ | |||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND.getCode(),"存在未匹配poi的门店"); | |||
| } | |||
| List<Product.PoiStruct> poiList = new ArrayList(); | |||
| for (TtMerchantPoi poi: pois) { | |||
| Product.PoiStruct poiStruct = new Product.PoiStruct(); | |||
| poiStruct.setSupplierExtId(poi.getSupplierExtId()); | |||
| poiList.add(poiStruct); | |||
| } | |||
| WxMerchant payAccountMerchant = null; | |||
| if (EnumCouponType.isParentCoupon(coupon.getType())) { | |||
| if (EnumCouponType.COUPON_DOUYIN_PLAT.getCode() == coupon.getType()) { | |||
| payAccountMerchant = wxMerchantService.findAdmin(coupon); | |||
| }else if (EnumCouponType.COUPON_DOUYIN_BRAND.getCode() == coupon.getType()) { | |||
| payAccountMerchant = wxMerchantService.findBrandAdmin(coupon, coupon.getBrand()); | |||
| }else { | |||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND.getCode(),"当前券类型未找到收款商户"); | |||
| } | |||
| }else { | |||
| WxMerchant merchantQ = new WxMerchant(); | |||
| merchantQ.updateTenantInfo(coupon); | |||
| merchantQ.setIds(merchantIds); | |||
| merchantQ.setSortColumns(BaseEntity.SortField.MerchantAdmin); | |||
| payAccountMerchant = wxMerchantMapper.findIdNameList(merchantQ).get(0); | |||
| } | |||
| //投放到抖音渠道,获取详情地址,以做审核 | |||
| WxCouponChannel wxCouponChannelQuery = new WxCouponChannel(); | |||
| wxCouponChannelQuery.updateTenantInfo(coupon); | |||
| wxCouponChannelQuery.setCouponId(coupon.getId()); | |||
| wxCouponChannelQuery.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN.getCode()); | |||
| List<WxCouponChannel> wxCouponChannels = wxCouponChannelMapper.findList(wxCouponChannelQuery); | |||
| WxCouponChannel wxCouponChannel = null; | |||
| Date now = new Date(); | |||
| if(wxCouponChannels == null || wxCouponChannels.isEmpty()){ | |||
| wxCouponChannel = new WxCouponChannel(); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| wxCouponChannel.setId(idWorker.nextId()); | |||
| wxCouponChannel.updateTenantInfo(coupon); | |||
| wxCouponChannel.setShowBeginTime(now); | |||
| wxCouponChannel.setBeginTime(now); | |||
| wxCouponChannel.setEndTime(coupon.getValidEndDate()); | |||
| wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_BEFORE.getCode()); | |||
| wxCouponChannel.setCouponId(coupon.getId()); | |||
| wxCouponChannel.setMakeMerchantId(coupon.getMakeMerchantId()); | |||
| wxCouponChannel.setType(coupon.getType()); | |||
| wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN.getCode()); | |||
| wxCouponChannel.setBusiness(coupon.getBusiness()); | |||
| wxCouponChannel.setSubBusiness(coupon.getSubBusiness()); | |||
| wxCouponChannel.setTitle(coupon.getTitle()); | |||
| wxCouponChannelMapper.insert(wxCouponChannel); | |||
| }else if(wxCouponChannels.size() == 1){ | |||
| wxCouponChannel = wxCouponChannels.get(0); | |||
| wxCouponChannel.setShowBeginTime(now); | |||
| wxCouponChannel.setBeginTime(now); | |||
| wxCouponChannel.setEndTime(coupon.getValidEndDate()); | |||
| wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_BEFORE.getCode()); | |||
| wxCouponChannel.setCouponId(coupon.getId()); | |||
| wxCouponChannel.setMakeMerchantId(coupon.getMakeMerchantId()); | |||
| wxCouponChannel.setType(coupon.getType()); | |||
| wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN.getCode()); | |||
| wxCouponChannel.setBusiness(coupon.getBusiness()); | |||
| wxCouponChannel.setSubBusiness(coupon.getSubBusiness()); | |||
| wxCouponChannel.setTitle(coupon.getTitle()); | |||
| wxCouponChannel.setUpdateDate(now); | |||
| wxCouponChannelMapper.updateById(wxCouponChannel); | |||
| }else{ | |||
| return new ResultData(ErrorCode.COUPON_CHANNEL_IS_EXISTED.getCode(),"此券状态异常,请重新创建"); | |||
| } | |||
| //提交审核 | |||
| try { | |||
| TtWebService ttWebService = ttMerchantPoiService.getTtWebService(coupon); | |||
| Product product = new Product(); | |||
| Product.ProductStruct prostruct = new Product.ProductStruct(); | |||
| prostruct.setOutId(coupon.getId().toString()); | |||
| prostruct.setProductName(coupon.getTitle()); | |||
| prostruct.setCategoryId(ttattrs.getCategoryId()); | |||
| prostruct.setProductType(ttattrs.getProductType()); | |||
| prostruct.setBizLine(5);//默认小程序 | |||
| prostruct.setAccountName(payAccountMerchant.getName()); | |||
| prostruct.setSoldStartTime((long) DateUtils.getSecondTimestamp(wxCouponChannel.getBeginTime())); | |||
| prostruct.setSoldEndTime((long) DateUtils.getSecondTimestamp(wxCouponChannel.getEndTime())); | |||
| prostruct.setOutUrl(getGoodsEntrySchema(coupon,wxCouponChannel.getId())); | |||
| prostruct.setPoiList(poiList); | |||
| Map<String, String> productAttrKeyValueMap = ttattrs.getProductAttrKeyValueMap(); | |||
| productAttrKeyValueMap.put("trade_url",getUpOrderEntrySchema(coupon,wxCouponChannel.getId())); | |||
| prostruct.setAttrKeyValueMap(productAttrKeyValueMap); | |||
| product.setProduct(prostruct); | |||
| Product.SkuStruct skuStruct = new Product.SkuStruct(); | |||
| skuStruct.setSkuName(coupon.getTitle()); | |||
| skuStruct.setOriginAmount(coupon.getPrice()); | |||
| skuStruct.setActualAmount(coupon.getSalePrice()); | |||
| Product.StockStruct stockStruct = new Product.StockStruct(); | |||
| stockStruct.setLimitType(1); | |||
| stockStruct.setStockQty(coupon.getInventory()); | |||
| skuStruct.setStock(stockStruct); | |||
| skuStruct.setStatus(1); | |||
| skuStruct.setAttrKeyValueMap(ttattrs.getSkuAttrKeyValueMap()); | |||
| product.setSku(skuStruct); | |||
| String productId = ttWebService.getGoodsService().productSave(product); | |||
| if(StringUtils.isBlank(productId)){ | |||
| throw new Exception("未获取到抖音商品product_id"); | |||
| } | |||
| syncCouponChannelPoi(coupon,wxCouponChannel.getId(),productId); | |||
| return new ResultData(); | |||
| } catch (WxErrorException e) { | |||
| throw new Exception(e.getError().getErrorMsg()); | |||
| // logger.error(e.getMessage()); | |||
| // return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); | |||
| } catch (Exception e){ | |||
| throw e; | |||
| // logger.error(e.getMessage()); | |||
| // return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); | |||
| } | |||
| } | |||
| @Override | |||
| @@ -117,9 +117,6 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| @Autowired | |||
| WxMallMapper wxMallMapper; | |||
| @Autowired | |||
| WxMerchantService wxMerchantService; | |||
| @Autowired | |||
| private String fmUploadDir; | |||
| @@ -868,233 +865,11 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| @Override | |||
| public void exportOweBill(WxBillAll wxBillAll, HttpServletRequest request, HttpServletResponse response) { | |||
| //商场名称 | |||
| // WxMall q = new WxMall(); | |||
| // q.setTenantInfo(wxBillAll); | |||
| WxMall wxMall = wxMallMapper.getByTenantInfo(wxBillAll); | |||
| //映射结果 | |||
| Map<String, Object> result = new HashMap<>(); | |||
| result.put("mall", wxMall.getName()); | |||
| //付款方式 | |||
| WxPayAccountBill wxPayAccountBill = new WxPayAccountBill(); | |||
| wxPayAccountBill.updateTenantInfo(wxBillAll); | |||
| WxPayAccountBill payAccountBill = wxPayAccountBillMapper.selectOne(new QueryWrapper(wxPayAccountBill)); | |||
| if (payAccountBill != null) { | |||
| String bankCardId = payAccountBill.getBankCardId(); | |||
| String bankAccountName = payAccountBill.getBankAccountName(); | |||
| result.put("accountNumber", StringUtils.isNotEmpty(bankCardId) ? bankCardId : " "); | |||
| result.put("accountName", StringUtils.isNotEmpty(bankAccountName) ? bankAccountName : " "); | |||
| } else { | |||
| result.put("accountNumber", " "); | |||
| result.put("accountName", " "); | |||
| } | |||
| //编号 | |||
| String number = "JF" + DateUtils.getSystemTime("yyyyMMddHHmmss"); | |||
| result.put("number", number); | |||
| //数据 | |||
| Integer status = wxBillAll.getStatus(); | |||
| if (status == null) { | |||
| List<Integer> statusList = new ArrayList<>(); | |||
| statusList.add(EnumBillRentStatus.NOT_PAID.getCode()); | |||
| statusList.add(EnumBillRentStatus.WAIT_PAY.getCode()); | |||
| statusList.add(EnumBillRentStatus.NOT_EXPIRED.getCode()); | |||
| wxBillAll.setStatusList(statusList); | |||
| //账单时间段 | |||
| result.put("starttime", wxBillAll.getStarttime()); | |||
| result.put("endtime", wxBillAll.getEndtime().substring(0, 10)); | |||
| } else { | |||
| result.put("starttime", " "); | |||
| result.put("endtime", " "); | |||
| } | |||
| Integer filterHasPay = wxBillAll.getFilterHasPay(); | |||
| //租金 | |||
| wxBillAll.setBillTypeValue(EnumBillQueryType.RENT.getCode()); | |||
| List<WxBillAllVo> rentList = this.list(wxBillAll); | |||
| Long rentSum = 0l; | |||
| if(!rentList.isEmpty()){ | |||
| rentSum = rentList.stream().collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); | |||
| } | |||
| //物业 | |||
| wxBillAll.setBillTypeValue(EnumBillQueryType.PROPERTY.getCode()); | |||
| List<WxBillAllVo> propertyList = this.list(wxBillAll); | |||
| Long propertySum = 0l; | |||
| if(!propertyList.isEmpty()){ | |||
| propertySum = propertyList.stream().collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); | |||
| } | |||
| //押金 | |||
| List<WxBillAllVo> depositList = new ArrayList<>(); | |||
| //租赁押金 | |||
| wxBillAll.setBillTypeValue(EnumBillQueryType.RENT_DEPOSIT.getCode()); | |||
| List<WxBillAllVo> rentDepositList = this.list(wxBillAll); | |||
| depositList.addAll(rentDepositList); | |||
| //物业押金 | |||
| wxBillAll.setBillTypeValue(EnumBillQueryType.PROPERTY_DEPOSIT.getCode()); | |||
| List<WxBillAllVo> propertyDepositList = this.list(wxBillAll); | |||
| depositList.addAll(propertyDepositList); | |||
| //其他押金 | |||
| wxBillAll.setBillTypeValue(EnumBillQueryType.OTHER_DEPOSIT.getCode()); | |||
| List<WxBillAllVo> otherDepositList = this.list(wxBillAll); | |||
| depositList.addAll(otherDepositList); | |||
| Long depositSum = 0l; | |||
| StringBuffer depositDetail = new StringBuffer();//押金明细 | |||
| if(!depositList.isEmpty()){ | |||
| depositSum = depositList.stream().collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); | |||
| depositList.stream().forEach(b -> { | |||
| BigDecimal owe = new BigDecimal(status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe()).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| depositDetail.append(b.getName()).append(":[").append(owe.toPlainString()).append("] "); | |||
| }); | |||
| } | |||
| //水电空调费 | |||
| wxBillAll.setBillTypeValue(EnumBillQueryType.WATER_POWER_AIR.getCode()); | |||
| List<WxBillAllVo> waterPowerAirList = this.list(wxBillAll); | |||
| Long waterSum = 0l, powerSum = 0l, airConditioningSum = 0l; | |||
| if (!waterPowerAirList.isEmpty()) { | |||
| waterSum = waterPowerAirList.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.WATER.getCode())) | |||
| .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); | |||
| powerSum = waterPowerAirList.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.POWER.getCode())) | |||
| .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); | |||
| airConditioningSum = waterPowerAirList.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.AIR_CONDITIONING.getCode())) | |||
| .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); | |||
| } | |||
| //其他费用 | |||
| wxBillAll.setBillTypeValue(EnumBillQueryType.OTHER.getCode()); | |||
| List<WxBillAllVo> otherList = this.list(wxBillAll); | |||
| Long otherSum = 0l; | |||
| StringBuffer otherDetail = new StringBuffer();//其他费用明细 | |||
| if(!otherList.isEmpty()){ | |||
| otherSum = otherList.stream().collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); | |||
| otherList.stream().forEach(b -> { | |||
| BigDecimal owe = new BigDecimal(status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe()).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| otherDetail.append(b.getName()).append(":[").append(owe.toPlainString()).append("] "); | |||
| }); | |||
| } | |||
| //总计 | |||
| Long summarySum = rentSum + propertySum + depositSum + waterSum + powerSum + airConditioningSum + otherSum; | |||
| BigDecimal rent = new BigDecimal(rentSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| BigDecimal property = new BigDecimal(propertySum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| BigDecimal deposit = new BigDecimal(depositSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| BigDecimal water = new BigDecimal(waterSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| BigDecimal power = new BigDecimal(powerSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| BigDecimal airConditioning = new BigDecimal(airConditioningSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| BigDecimal other = new BigDecimal(otherSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| BigDecimal summary = new BigDecimal(summarySum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| String summaryUpper = PriceUtil.number2CNMontrayUnit(summary); | |||
| result.put("rent", rent.toPlainString()); | |||
| result.put("property", property.toPlainString()); | |||
| result.put("deposit", deposit.toPlainString()); | |||
| result.put("water", water.toPlainString()); | |||
| result.put("power", power.toPlainString()); | |||
| result.put("airConditioning", airConditioning.toPlainString()); | |||
| result.put("other", other.toPlainString()); | |||
| result.put("summary", summary.toPlainString()); | |||
| result.put("summaryUpper", summaryUpper); | |||
| result.put("depositDetail", StringUtils.isNotEmpty(depositDetail.toString()) ? depositDetail.toString() : " "); | |||
| result.put("otherDetail", StringUtils.isNotEmpty(otherDetail.toString()) ? otherDetail.toString() : " "); | |||
| WxMerchantDto wxMerchantDto = new WxMerchantDto(); | |||
| wxMerchantDto.setId(wxBillAll.getMerchantId()); | |||
| wxMerchantDto.updateTenantInfo(wxMall); | |||
| PageInfo<WxMerchantVo> pageInfo = wxMerchantService.listAsPageCVo(wxMerchantDto,1,1,true); | |||
| List<WxMerchantVo> listCVo = pageInfo.getList(); | |||
| WxMerchantVo wxMerchantVo = listCVo.get(0); | |||
| result.put("merchant", wxMerchantVo.getMerchantName()); | |||
| WxShopVo wxShopVo = wxMerchantVo.getShopVoList().stream() | |||
| .filter(s -> StringUtils.isNotEmpty(s.getLinkPhone()) || StringUtils.isNotEmpty(s.getLinkPerson())).findFirst().orElse(null); | |||
| if (wxShopVo != null) { | |||
| String linkPerson = wxShopVo.getLinkPerson(); | |||
| String linkPhone = wxShopVo.getLinkPhone(); | |||
| result.put("linkPerson", StringUtils.isNotEmpty(linkPerson) ? linkPerson : " "); | |||
| result.put("linkPhone", StringUtils.isNotEmpty(linkPhone) ? linkPhone : " "); | |||
| } else { | |||
| result.put("linkPerson", " "); | |||
| result.put("linkPhone", " "); | |||
| } | |||
| String createtime = DateUtils.getSystemTime("yyyy-MM-dd"); | |||
| result.put("createtime", createtime); | |||
| String templatePath = "contract-word-template/bill_owe.docx"; | |||
| String filepath = fmUploadDir; | |||
| String filename = UUID.randomUUID() + ".docx"; | |||
| String exportFileName = "催缴单.docx"; | |||
| WordUtil.exportWord(templatePath, filepath, filename, exportFileName, result, request, response, null); | |||
| } | |||
| @Override | |||
| public void exportSettleBill(WxBillSettle wxBillSettle, HttpServletRequest request, HttpServletResponse response) { | |||
| wxBillSettle = wxBillSettleService.getById(wxBillSettle.getId(), EnumFilterSettle.NO.getCode()); | |||
| if (wxBillSettle.getReceiveBillIds() == null) { | |||
| wxBillSettle.setReceiveBillIds(new ArrayList<>()); | |||
| } | |||
| if (wxBillSettle.getPayBillIds() == null) { | |||
| wxBillSettle.setPayBillIds(new ArrayList<>()); | |||
| } | |||
| //映射结果 | |||
| Map<String, Object> result = new HashMap<>(); | |||
| // WxMall q = new WxMall(); | |||
| // q.setTenantInfo(wxBillSettle); | |||
| WxMall wxMall = wxMallMapper.getByTenantInfo(wxBillSettle); | |||
| result.put("mall", wxMall.getName()); | |||
| result.put("merchant", wxMerchantService.selectById(wxBillSettle.getMerchantId()).getName()); | |||
| result.put("num", wxBillSettle.getSettleNumber()); | |||
| result.put("cdate", DateUtils.format(wxBillSettle.getCreatetime())); | |||
| BigDecimal receiveM = (new BigDecimal(wxBillSettle.getReceiveMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)); | |||
| BigDecimal payM = (new BigDecimal(wxBillSettle.getPayMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)); | |||
| BigDecimal bM = (new BigDecimal(wxBillSettle.getBalance()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)); | |||
| result.put("receiveM", receiveM.toString() + "元"); | |||
| result.put("payM", payM.toString() + "元"); | |||
| result.put("bM", bM.toString() + "元"); | |||
| result.put("receiveMU", PriceUtil.digitUppercase(receiveM.doubleValue())); | |||
| result.put("payMU", PriceUtil.digitUppercase(payM.doubleValue())); | |||
| result.put("bMU", PriceUtil.digitUppercase(bM.doubleValue())); | |||
| WordDocTableVo wordDocTableVo = new WordDocTableVo(); | |||
| List<List<String>> rowsParams = new ArrayList<>(); | |||
| int size = wxBillSettle.getReceiveBillIds().size() > wxBillSettle.getPayBillIds().size() ? wxBillSettle.getReceiveBillIds().size() : wxBillSettle.getPayBillIds().size(); | |||
| int count = 1; | |||
| for (int i = 0; i < size; i++) { | |||
| WxBillSettleBill bill = i > wxBillSettle.getReceiveBillIds().size() - 1 ? null : wxBillSettle.getReceiveBillIds().get(i); | |||
| List<String> cellList = new ArrayList<>(); | |||
| cellList.add(count + ""); | |||
| if (bill != null) { | |||
| cellList.add(bill.getBillName()); | |||
| cellList.add(new BigDecimal(bill.getReceivePay()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).toString()); | |||
| } else { | |||
| cellList.add(""); | |||
| cellList.add(""); | |||
| } | |||
| cellList.add(count + ""); | |||
| WxBillSettleBill payBill = i > wxBillSettle.getPayBillIds().size() - 1 ? null : wxBillSettle.getPayBillIds().get(i); | |||
| if (payBill != null) { | |||
| cellList.add(payBill.getBillName()); | |||
| cellList.add(new BigDecimal(payBill.getReceivePay()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).toString()); | |||
| } else { | |||
| cellList.add(""); | |||
| cellList.add(""); | |||
| } | |||
| rowsParams.add(cellList); | |||
| count++; | |||
| } | |||
| wordDocTableVo.setParams(rowsParams); | |||
| wordDocTableVo.setTableIndex(0); | |||
| wordDocTableVo.setRowIndex(2); | |||
| String templatePath = "contract-word-template/settle.docx"; | |||
| String filepath = fmUploadDir; | |||
| String filename = UUID.randomUUID() + ".docx"; | |||
| String exportFileName = "结算单.docx"; | |||
| WordUtil.exportWord(templatePath, filepath, filename, exportFileName, result, request, response, wordDocTableVo); | |||
| } | |||
| @@ -18,7 +18,6 @@ import com.iformall.mapper.WxMerchantMapper; | |||
| import com.iformall.mapper.WxMsgValidationcodeMapper; | |||
| import com.iformall.service.WxMallService; | |||
| import com.iformall.service.WxMerchantBUserService; | |||
| import com.iformall.service.WxMerchantService; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -42,8 +41,6 @@ public class WxMerchantBUserServiceImpl implements WxMerchantBUserService { | |||
| @Autowired | |||
| WxAppinfoMapper wxAppinfoMapper; | |||
| @Autowired | |||
| WxMerchantService wxMerchantService; | |||
| @Autowired | |||
| WxMerchantMapper wxMerchantMapper; | |||
| @@ -206,29 +203,7 @@ public class WxMerchantBUserServiceImpl implements WxMerchantBUserService { | |||
| @Override | |||
| public List<WxMerchantBuInfoVo> handMerchantBUser(List<WxMerchantBUser> orgList) { | |||
| List<String> tenantIds = orgList.stream().map(mb -> mb.getTenantId()).collect(Collectors.toList()); | |||
| WxMall mallQ = new WxMall(); | |||
| mallQ.setTenantIdList(tenantIds); | |||
| Map<String,WxMall> mallMap = wxMallService.getMallMap(mallQ); | |||
| List<Long> merchantIds = orgList.stream().map(mb -> mb.getMerchantId()).collect(Collectors.toList()); | |||
| WxMerchant merchantQ = new WxMerchant(); | |||
| merchantQ.setIds(merchantIds); | |||
| Map<Long,WxMerchant> merchantMap = wxMerchantService.findMerchantMap(merchantQ); | |||
| List<WxMerchantBuInfoVo> listvo = new ArrayList<>(); | |||
| for (WxMerchantBUser bUser:orgList) { | |||
| WxMerchantBuInfoVo mbvo = new WxMerchantBuInfoVo(); | |||
| WxMall wxMall = mallMap.get(bUser.getTenantId()); | |||
| mbvo.updateTenantInfo(wxMall); | |||
| mbvo.setTenantName(wxMall.getName()); | |||
| mbvo.setMerchantId(mbvo.getMerchantId()); | |||
| WxMerchant merchant = merchantMap.get(bUser.getMerchantId()); | |||
| mbvo.setMerchantName(merchant.getName()); | |||
| mbvo.setImgUrl(merchant.getImgUrl()); | |||
| mbvo.setBuUserId(bUser.getId()); | |||
| listvo.add(mbvo); | |||
| } | |||
| return listvo; | |||
| return null; | |||
| } | |||
| @@ -37,9 +37,6 @@ public class WxMerchantTradeDailyServiceImpl implements WxMerchantTradeDailyServ | |||
| @Autowired | |||
| WxMerchantBUserService wxMerchantBUserService; | |||
| @Autowired | |||
| WxMerchantService wxMerchantService; | |||
| @Autowired | |||
| WxMallService wxMallService; | |||
| @@ -88,45 +85,7 @@ public class WxMerchantTradeDailyServiceImpl implements WxMerchantTradeDailyServ | |||
| return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
| } | |||
| WxMerchant merchant = wxMerchantService.getById(user.getMerchantId()); | |||
| if (merchant==null) { | |||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND); | |||
| } | |||
| WxMall mall = wxMallService.getByTenantInfo(merchant); | |||
| if (mall==null) { | |||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND); | |||
| } | |||
| WxMerchantTradeDaily wxMerchantTradeDaily = new WxMerchantTradeDaily(); | |||
| wxMerchantTradeDaily.setMerchantId(merchant.getId()); | |||
| SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); | |||
| wxMerchantTradeDaily.setReportDate(fmt.format(new Date())); | |||
| List<WxMerchantTradeDaily> tradeList = wxMerchantTradeDailyMapper.findList(wxMerchantTradeDaily); | |||
| if (tradeList.size() > 0) { | |||
| wxMerchantTradeDaily = tradeList.get(0); | |||
| wxMerchantTradeDaily.setTradeAmt(volume + ""); | |||
| wxMerchantTradeDaily.setUpdateDate(new Date()); | |||
| wxMerchantTradeDailyMapper.updateById(wxMerchantTradeDaily); | |||
| return new ResultData(wxMerchantTradeDaily); | |||
| } | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| wxMerchantTradeDaily.setId(idWorker.nextId()); | |||
| wxMerchantTradeDaily.updateTenantInfo(merchant); | |||
| wxMerchantTradeDaily.setMerchantId(merchant.getId()); | |||
| wxMerchantTradeDaily.setbUserId(userId); | |||
| wxMerchantTradeDaily.setTradeAmt(volume + ""); | |||
| wxMerchantTradeDaily.setCreateDate(new Date()); | |||
| wxMerchantTradeDaily.setUpdateDate(new Date()); | |||
| wxMerchantTradeDailyMapper.insert(wxMerchantTradeDaily); | |||
| return new ResultData(wxMerchantTradeDaily); | |||
| return new ResultData(); | |||
| } | |||
| @@ -223,42 +182,8 @@ public class WxMerchantTradeDailyServiceImpl implements WxMerchantTradeDailyServ | |||
| @Override | |||
| public ResultData getVolumeOfMonth(Long merchantId) { | |||
| WxMerchant merchant = wxMerchantService.getById(merchantId); | |||
| if (merchant == null) | |||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND); | |||
| WxMerchantTradeDaily wxMerchantTradeDaily = new WxMerchantTradeDaily(); | |||
| wxMerchantTradeDaily.setMerchantId(merchantId); | |||
| String startTime = DateUtils.getTimeBefore(29, new Date()); | |||
| String endTime = DateUtils.getSystemTime("yyyy-MM-dd"); | |||
| wxMerchantTradeDaily.setStartTime(startTime); | |||
| wxMerchantTradeDaily.setEndTime(endTime); | |||
| List<WxMerchantTradeDailyVo> recordList = wxMerchantTradeDailyMapper.findVoList(wxMerchantTradeDaily); | |||
| Map<String, WxMerchantTradeDailyVo> recordMap = recordList.stream().collect(Collectors.toMap(WxMerchantTradeDailyVo::getReportDate, r -> r)); | |||
| List<WxMerchantTradeDailyVo> tradeList = new ArrayList<>(); | |||
| Calendar cal = Calendar.getInstance(); | |||
| SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); | |||
| SimpleDateFormat fmtv = new SimpleDateFormat("MM/dd"); | |||
| for (int i = 0; i < 30; i++) { | |||
| cal.setTime(new Date()); | |||
| cal.add(Calendar.DAY_OF_YEAR, -i); | |||
| WxMerchantTradeDailyVo trade = recordMap.get(fmt.format(cal.getTime())); | |||
| if (trade != null) { | |||
| trade.setReportDate(fmtv.format(cal.getTime())); | |||
| trade.setTenantId(null); | |||
| trade.setMerchantId(null); | |||
| trade.setMerchantName(null); | |||
| tradeList.add(trade); | |||
| } else { | |||
| trade = new WxMerchantTradeDailyVo(); | |||
| trade.setTradeAmt(0); | |||
| trade.setReportDate(fmtv.format(cal.getTime())); | |||
| tradeList.add(trade); | |||
| } | |||
| cal.clear(); | |||
| } | |||
| Collections.reverse(tradeList); | |||
| return new ResultData(tradeList); | |||
| return new ResultData(); | |||
| } | |||
| @Override | |||
| @@ -302,32 +227,7 @@ public class WxMerchantTradeDailyServiceImpl implements WxMerchantTradeDailyServ | |||
| if (user==null) { | |||
| return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
| } | |||
| WxMerchant merchant = wxMerchantService.getById(user.getMerchantId()); | |||
| if (merchant==null) { | |||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND); | |||
| } | |||
| WxMall mall = wxMallService.getByTenantInfo(merchant); | |||
| if (mall==null) { | |||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND); | |||
| } | |||
| WxMerchantTradeDaily wxMerchantTradeDaily = new WxMerchantTradeDaily(); | |||
| wxMerchantTradeDaily.setMerchantId(merchant.getId()); | |||
| if (merchantTradeDaily.getReportDate() != null) { | |||
| wxMerchantTradeDaily.setReportDate(merchantTradeDaily.getReportDate()); | |||
| } else { | |||
| SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); | |||
| wxMerchantTradeDaily.setReportDate(fmt.format(new Date())); | |||
| } | |||
| List<WxMerchantTradeDaily> tradeList = wxMerchantTradeDailyMapper.findList(wxMerchantTradeDaily); | |||
| if (tradeList.size() > 0) { | |||
| wxMerchantTradeDaily = tradeList.get(0); | |||
| return new ResultData(wxMerchantTradeDaily); | |||
| } | |||
| return new ResultData(ErrorCode.DALIY_REPORT_VOLUME_TODAY_NULL); | |||
| } | |||
| @@ -335,29 +235,8 @@ public class WxMerchantTradeDailyServiceImpl implements WxMerchantTradeDailyServ | |||
| @Override | |||
| public ResultData getVolumeOfWeek(Long userId) { | |||
| WxMerchantBUser user = wxMerchantBUserService.getById(userId); | |||
| if (user==null) { | |||
| return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
| } | |||
| WxMerchant merchant = wxMerchantService.getById(user.getMerchantId()); | |||
| if (merchant==null) { | |||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND); | |||
| } | |||
| WxMall mall = wxMallService.getByTenantInfo(merchant); | |||
| if (mall==null) { | |||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND); | |||
| } | |||
| WxMerchantTradeDaily wxMerchantTradeDaily = new WxMerchantTradeDaily(); | |||
| wxMerchantTradeDaily.setMerchantId(merchant.getId()); | |||
| SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); | |||
| wxMerchantTradeDaily.setReportDate(fmt.format(new Date())); | |||
| return new ResultData(wxMerchantTradeDailyMapper.findListOfWeek(wxMerchantTradeDaily)); | |||
| return new ResultData(); | |||
| } | |||
| @@ -44,8 +44,6 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR | |||
| @Autowired | |||
| WxAppinfoService wxAppinfoService; | |||
| @Autowired | |||
| WxMerchantService wxMerchantService; | |||
| @Autowired | |||
| WxPayAccountService wxPayAccountService; | |||
| @@ -112,50 +110,7 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR | |||
| if(receiverApply == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未找到数据"); | |||
| } | |||
| WxMerchant merchant = wxMerchantService.selectById(receiverApply.getMerchantId()); | |||
| if(merchant == null || EnumMerchantStatus.NOT_VALID.getCode().equals(merchant.getStatus())){ | |||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_VALID.getCode(),"商户不存在或已停用"); | |||
| } | |||
| if(receiverApply.getApplymentState() != null && !EnumSharingReceiverApplymentState.getUpdList().contains(receiverApply.getApplymentState())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "该商户进件流程中,无法申请"); | |||
| } | |||
| if(!this.isFinishMain(receiverApply)){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未完成主体资质"); | |||
| } | |||
| if(!this.isFinishBusiness(receiverApply)){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未完成经营信息"); | |||
| } | |||
| if(!this.isFinishSettlement(receiverApply)){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未完成行业资质"); | |||
| } | |||
| if(!this.isFinishBankAccount(receiverApply)){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未完成结算帐号"); | |||
| } | |||
| if(!this.isFinishContact(receiverApply)){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未完成超级管理员"); | |||
| } | |||
| ResultData result = this.applyment4subApplyment(receiverApply); | |||
| if(result.code == 200){ | |||
| WxProfitSharingReceiverApply receiverApplyUpd = new WxProfitSharingReceiverApply(); | |||
| receiverApplyUpd.updateTenantInfo(receiverApply); | |||
| receiverApplyUpd.setId(receiverApply.getId()); | |||
| receiverApplyUpd.setApplymentId((String) result.data); | |||
| receiverApplyUpd.setApplymentState(EnumSharingReceiverApplymentState.APPLYMENT_STATE_SUBMIT.getCode()); | |||
| receiverApplyUpd.setApplymentStateDesc(EnumSharingReceiverApplymentState.APPLYMENT_STATE_SUBMIT.getMessage()); | |||
| if(receiverApply.getFunctionState() == null){ | |||
| receiverApplyUpd.setFunctionState(EnumSharingReceiverApplyFunctionStatus.wait.getCode()); | |||
| receiverApplyUpd.setFunctionStateDesc(EnumSharingReceiverApplyFunctionStatus.wait.getMessage()); | |||
| } | |||
| receiverApplyUpd.setSignUrl(""); | |||
| receiverApplyUpd.setAuditDetail("[]"); | |||
| receiverApplyUpd.setUpdateTime(new Date()); | |||
| wxProfitSharingReceiverApplyMapper.updateById(receiverApplyUpd); | |||
| return result; | |||
| }else{ | |||
| return result; | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @Override | |||
| @@ -64,9 +64,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| @Autowired | |||
| WxShopMapper wxShopMapper; | |||
| @Lazy | |||
| @Autowired | |||
| WxMerchantService wxMerchantService; | |||
| @Autowired | |||
| WxBillRentMapper wxBillRentMapper; | |||
| @@ -220,13 +217,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| wxRentContract.setDeposit(wxRentContract.getDeposit() != null ? wxRentContract.getDeposit() : 0); | |||
| result.put("wxRentContract", wxRentContract); | |||
| //关联的商户 | |||
| if (wxRentContract.getMerchantId() != null) { | |||
| WxMerchant wxMerchant = wxMerchantService.getById(wxRentContract.getMerchantId()); | |||
| result.put("wxMerchant", wxMerchant); | |||
| } else { | |||
| result.put("wxMerchant", null); | |||
| } | |||
| //关联的店铺 | |||
| if (wxRentContract.shopIdsByRentInfo().size()> 0) { | |||
| WxShop record = new WxShop(); | |||
| @@ -2067,38 +2057,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| result.put("mallAddr", wxMall.getAddr()); | |||
| result.put("mallServicePhone", wxMall.getServicePhone()); | |||
| //商户信息 | |||
| WxMerchant merchant = wxMerchantService.getById(wxRentContract.getMerchantId()); | |||
| //经营业态 | |||
| wxRentContract.getMerchantId(); | |||
| WxBusiness wxBusiness = wxBusinessMapper.selectById(merchant.getBusinessId()); | |||
| result.put("business", wxBusiness.getTitle()); | |||
| if (merchant != null) { | |||
| result.put("merchantName", merchant.getName()); | |||
| //法人信息 | |||
| WxMerchantCorp wxMerchantCorp = merchant.getWxMerchantCorp(); | |||
| result.put("corpPapersNumber", StringUtils.isNotEmpty(wxMerchantCorp.getCorpPapersNumber()) ? wxMerchantCorp.getCorpPapersNumber() : " "); | |||
| result.put("corpPapersType", wxMerchantCorp.getCorpPapersType() != null ? EnumPapersType.getEnum(wxMerchantCorp.getCorpPapersType()).getMessage() : " "); | |||
| result.put("corpPapersPerson", StringUtils.isNotEmpty(wxMerchantCorp.getCorpPapersPerson()) ? wxMerchantCorp.getCorpPapersPerson() : " "); | |||
| //税务信息 | |||
| WxMerchantTax wxMerchantTax = merchant.getWxMerchantTax(); | |||
| result.put("taxPapersType", wxMerchantTax.getTaxPapersType() != null ? EnumTaxpayerType.getEnum(wxMerchantTax.getTaxPapersType()).getMessage() : " "); | |||
| result.put("bankName", StringUtils.isNotEmpty(wxMerchantTax.getBankName()) ? wxMerchantTax.getBankName() : " "); | |||
| result.put("bankAccount", StringUtils.isNotEmpty(wxMerchantTax.getBankAccount()) ? wxMerchantTax.getBankAccount() : " "); | |||
| result.put("invoiceAddressPhone", StringUtils.isNotEmpty(wxMerchantTax.getInvoiceAddressPhone()) ? wxMerchantTax.getInvoiceAddressPhone() : " "); | |||
| } else { | |||
| result.put("merchantName", ""); | |||
| //法人信息 | |||
| result.put("corpPapersNumber", " "); | |||
| result.put("corpPapersType", " "); | |||
| result.put("corpPapersPerson", " "); | |||
| //税务信息 | |||
| result.put("taxPapersType", " "); | |||
| result.put("bankName", " "); | |||
| result.put("bankAccount", " "); | |||
| result.put("invoiceAddressPhone", " "); | |||
| } | |||
| //租赁合同信息 | |||
| if(StringUtils.isNotBlank(wxRentContract.getContractualRules())){ | |||