| @@ -41,7 +41,7 @@ public class WxMerchantTradeDailyController extends BaseController { | |||||
| SimpleDateFormat fmt=new SimpleDateFormat("yyyy-MM-dd"); | SimpleDateFormat fmt=new SimpleDateFormat("yyyy-MM-dd"); | ||||
| wxMerchantTradeDaily.setReportDate(fmt.format(cal.getTime())); | wxMerchantTradeDaily.setReportDate(fmt.format(cal.getTime())); | ||||
| wxMerchantTradeDaily.setSortColumns(WxMerchantTradeDailyVo.Field.MerchantId_DESC); | wxMerchantTradeDaily.setSortColumns(WxMerchantTradeDailyVo.Field.MerchantId_DESC); | ||||
| final PageInfo<WxMerchantTradeDailyVo> page = wxMerchantTradeDailyService.listAsPageVo(wxMerchantTradeDaily, pageNum, pageSize); | |||||
| PageInfo<WxMerchantTradeDailyVo> page = wxMerchantTradeDailyService.listAsPageVo(wxMerchantTradeDaily, pageNum, pageSize); | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @@ -44,7 +44,7 @@ public class WxRentContractController extends BaseController { | |||||
| public ResultData add(@RequestBody WxRentContract wxRentContract) { | public ResultData add(@RequestBody WxRentContract wxRentContract) { | ||||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::add"); | logger.debug("[" + getIpAddr() + "] WxRentContractController::add"); | ||||
| wxRentContract.setTenantId(getTenantId()); | wxRentContract.setTenantId(getTenantId()); | ||||
| return wxRentContractService.save(wxRentContract, getUser().getId()); | |||||
| return wxRentContractService.save(wxRentContract, getUser().getId(),getUser().getName()); | |||||
| } | } | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| @@ -115,9 +115,10 @@ public class WxRentContractController extends BaseController { | |||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name = "pageNum", 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)}) | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | ||||
| public ResultData getRentContractList(Integer pageNum, Integer pageSize) { | |||||
| public ResultData getRentContractList(@ModelAttribute WxRentContract wxRentContract, Integer pageNum, Integer pageSize) { | |||||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::getRentContractList"); | logger.debug("[" + getIpAddr() + "] WxRentContractController::getRentContractList"); | ||||
| return new ResultData(wxRentContractService.getRentContractList(getTenantId(),pageNum, pageSize)); | |||||
| wxRentContract.setTenantId(getTenantId()); | |||||
| return new ResultData(wxRentContractService.getRentContractList(wxRentContract, pageNum, pageSize)); | |||||
| } | } | ||||
| @GetMapping("exportContract") | @GetMapping("exportContract") | ||||
| @@ -131,7 +132,7 @@ public class WxRentContractController extends BaseController { | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | ||||
| public ResultData updateRentContractStatus(Long id) { | public ResultData updateRentContractStatus(Long id) { | ||||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::updateRentContractStatus"); | logger.debug("[" + getIpAddr() + "] WxRentContractController::updateRentContractStatus"); | ||||
| return wxRentContractService.updateRentContractStatus(id, getUser().getId()); | |||||
| return wxRentContractService.updateRentContractStatus(id); | |||||
| } | } | ||||
| } | } | ||||
| @@ -116,26 +116,26 @@ public class WxUserStructureController extends BaseController { | |||||
| dto.setTenantId(getTenantId()); | dto.setTenantId(getTenantId()); | ||||
| dto.setStartTime(startTime); | dto.setStartTime(startTime); | ||||
| dto.setEndTime(endTime); | dto.setEndTime(endTime); | ||||
| if (i == 0) { | |||||
| dto.setLevelEndScore(levelList.get(i).getPoints()); | |||||
| } else if (i == levelList.size()-1) { | |||||
| dto.setLevelStartScore(levelList.get(i).getPoints()); | |||||
| } else{ | |||||
| if (i + 1 < levelList.size()) { | |||||
| dto.setLevelStartScore(levelList.get(i).getPoints()); | dto.setLevelStartScore(levelList.get(i).getPoints()); | ||||
| dto.setLevelEndScore(levelList.get(i+1).getPoints()); | dto.setLevelEndScore(levelList.get(i+1).getPoints()); | ||||
| }else{ | |||||
| dto.setLevelStartScore(levelList.get(i).getPoints()); | |||||
| } | } | ||||
| long all = wxCUserBasicInfoService.findCountByScore(dto); | long all = wxCUserBasicInfoService.findCountByScore(dto); | ||||
| //null积分算最低级会员 | |||||
| if (i == 0){ | |||||
| dto.setLevelStartScore(null); | |||||
| dto.setLevelEndScore(null); | |||||
| all += wxCUserBasicInfoService.findCountByScore(dto); | |||||
| } | |||||
| levelList.get(i).setCount(all); | levelList.get(i).setCount(all); | ||||
| } | } | ||||
| WxLevelConfig other = new WxLevelConfig(); | |||||
| //没有等级的会员 | |||||
| other.setLevel("无"); | |||||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||||
| other.setCount(wxCUserBasicInfoService.findCount(dto) | |||||
| -levelList.stream().map(WxLevelConfig::getCount).reduce(Long::sum).get()); | |||||
| levelList.add(other); | |||||
| return new ResultData(levelList); | return new ResultData(levelList); | ||||
| } | } | ||||
| @@ -27,6 +27,12 @@ public enum ErrorCode{ | |||||
| SYS_EXTEND_JSON_ERROR(1012, "JSON格式异常"), | SYS_EXTEND_JSON_ERROR(1012, "JSON格式异常"), | ||||
| SYS_REPEAT_SUBMIT_EXCEPTION(1013, "请勿重复操作"), | SYS_REPEAT_SUBMIT_EXCEPTION(1013, "请勿重复操作"), | ||||
| /** | |||||
| * 数据库 | |||||
| */ | |||||
| FLOW_FAIL(24000, "审批流操作出错"), | |||||
| /** | /** | ||||
| * 数据库 | * 数据库 | ||||
| */ | */ | ||||
| @@ -7,6 +7,7 @@ import java.io.Serializable; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | |||||
| /** | /** | ||||
| * @author gongbiao | * @author gongbiao | ||||
| @@ -190,6 +191,20 @@ public class WxRentContract implements Serializable { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType") | @io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType") | ||||
| private Integer rentShopType; | private Integer rentShopType; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "创建合同方式1新建2补录", name = "way") | |||||
| private Integer way; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "审批流参数", name = "flowParams") | |||||
| private Map<String, Object> flowParams; | |||||
| public Map<String, Object> getFlowParams() { | |||||
| return flowParams; | |||||
| } | |||||
| public void setFlowParams(Map<String, Object> flowParams) { | |||||
| this.flowParams = flowParams; | |||||
| } | |||||
| public Integer getApplyStatus() { | public Integer getApplyStatus() { | ||||
| return applyStatus; | return applyStatus; | ||||
| } | } | ||||
| @@ -486,6 +501,14 @@ public class WxRentContract implements Serializable { | |||||
| this.rentShopType = rentShopType; | this.rentShopType = rentShopType; | ||||
| } | } | ||||
| public Integer getWay() { | |||||
| return way; | |||||
| } | |||||
| public void setWay(Integer way) { | |||||
| this.way = way; | |||||
| } | |||||
| public static enum Field { | public static enum Field { | ||||
| Id_ASC("`id` ASC"), Id_DESC("`id` DESC"), MerchantId_ASC("`merchant_id` ASC"), MerchantId_DESC("`merchant_id` DESC"), Price_ASC("`price` ASC"), Price_DESC("`price` DESC"), RentalStartDate_ASC("`rental_start_date` ASC"), RentalStartDate_DESC("`rental_start_date` DESC"), RentalEndDate_ASC("`rental_end_date` ASC"), RentalEndDate_DESC("`rental_end_date` DESC"), SignDate_ASC("`sign_date` ASC"), SignDate_DESC("`sign_date` DESC"), ReceivePeriod_ASC("`receive_period` ASC"), ReceivePeriod_DESC("`receive_period` DESC"), TenantId_ASC("`tenant_id` ASC"), TenantId_DESC("`tenant_id` DESC"), Filepath_ASC("`filepath` ASC"), Filepath_DESC("`filepath` DESC"), Status_ASC("`status` ASC"), Status_DESC("`status` DESC"), ContractNumber_ASC("`contract_number` ASC"), ContractNumber_DESC("`contract_number` DESC"), Deposit_ASC("`deposit` ASC"), Deposit_DESC("`deposit` DESC"), PayDate_ASC("`pay_date` ASC"), PayDate_DESC("`pay_date` DESC"), IsDel_ASC("`is_del` ASC"), IsDel_DESC("`is_del` DESC"), MerchantName_ASC("`merchant_name` ASC"), MerchantName_DESC("`merchant_name` DESC"), Brand_ASC("`brand` ASC"), Brand_DESC("`brand` DESC"), BusinessId_ASC("`business_id` ASC"), BusinessId_DESC("`business_id` DESC"), ShopType_ASC("`shop_type` ASC"), ShopType_DESC("`shop_type` DESC"), ShopId_ASC("`shop_id` ASC"), ShopId_DESC("`shop_id` DESC"), Updatetime_ASC("`updatetime` ASC"), Updatetime_DESC("`updatetime` DESC"), Createtime_ASC("`createtime` ASC"), Createtime_DESC("`createtime` DESC"); | Id_ASC("`id` ASC"), Id_DESC("`id` DESC"), MerchantId_ASC("`merchant_id` ASC"), MerchantId_DESC("`merchant_id` DESC"), Price_ASC("`price` ASC"), Price_DESC("`price` DESC"), RentalStartDate_ASC("`rental_start_date` ASC"), RentalStartDate_DESC("`rental_start_date` DESC"), RentalEndDate_ASC("`rental_end_date` ASC"), RentalEndDate_DESC("`rental_end_date` DESC"), SignDate_ASC("`sign_date` ASC"), SignDate_DESC("`sign_date` DESC"), ReceivePeriod_ASC("`receive_period` ASC"), ReceivePeriod_DESC("`receive_period` DESC"), TenantId_ASC("`tenant_id` ASC"), TenantId_DESC("`tenant_id` DESC"), Filepath_ASC("`filepath` ASC"), Filepath_DESC("`filepath` DESC"), Status_ASC("`status` ASC"), Status_DESC("`status` DESC"), ContractNumber_ASC("`contract_number` ASC"), ContractNumber_DESC("`contract_number` DESC"), Deposit_ASC("`deposit` ASC"), Deposit_DESC("`deposit` DESC"), PayDate_ASC("`pay_date` ASC"), PayDate_DESC("`pay_date` DESC"), IsDel_ASC("`is_del` ASC"), IsDel_DESC("`is_del` DESC"), MerchantName_ASC("`merchant_name` ASC"), MerchantName_DESC("`merchant_name` DESC"), Brand_ASC("`brand` ASC"), Brand_DESC("`brand` DESC"), BusinessId_ASC("`business_id` ASC"), BusinessId_DESC("`business_id` DESC"), ShopType_ASC("`shop_type` ASC"), ShopType_DESC("`shop_type` DESC"), ShopId_ASC("`shop_id` ASC"), ShopId_DESC("`shop_id` DESC"), Updatetime_ASC("`updatetime` ASC"), Updatetime_DESC("`updatetime` DESC"), Createtime_ASC("`createtime` ASC"), Createtime_DESC("`createtime` DESC"); | ||||
| private String value; | private String value; | ||||
| @@ -21,6 +21,11 @@ public class WxCouponSendVo extends WxCouponSend implements Serializable{ | |||||
| /*剩余库存**/ | /*剩余库存**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="剩余库存",name="remainInventory") | @io.swagger.annotations.ApiModelProperty(value="剩余库存",name="remainInventory") | ||||
| private Integer remainInventory; | private Integer remainInventory; | ||||
| /**限领张数**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="限领张数",name="useLimitQuantity") | |||||
| private Integer useLimitQuantity; | |||||
| /*总库存**/ | /*总库存**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="总库存",name="inventory") | @io.swagger.annotations.ApiModelProperty(value="总库存",name="inventory") | ||||
| private Integer inventory; | private Integer inventory; | ||||
| @@ -67,4 +72,12 @@ public class WxCouponSendVo extends WxCouponSend implements Serializable{ | |||||
| public void setMerchantName(String merchantName) { | public void setMerchantName(String merchantName) { | ||||
| this.merchantName = merchantName; | this.merchantName = merchantName; | ||||
| } | } | ||||
| public Integer getUseLimitQuantity() { | |||||
| return useLimitQuantity; | |||||
| } | |||||
| public void setUseLimitQuantity(Integer useLimitQuantity) { | |||||
| this.useLimitQuantity = useLimitQuantity; | |||||
| } | |||||
| } | } | ||||
| @@ -7,6 +7,7 @@ package com.iformall.enums; | |||||
| public enum EnumRentContractStatus { | public enum EnumRentContractStatus { | ||||
| INTENTION(0, "意向"), | |||||
| WAIT_SIGN(1, "待签约"), | WAIT_SIGN(1, "待签约"), | ||||
| SIGNED_RENT_UNPAID(2, "已签约未记租"), | SIGNED_RENT_UNPAID(2, "已签约未记租"), | ||||
| RENT_PAID(3, "计租中"), | RENT_PAID(3, "计租中"), | ||||
| @@ -33,7 +33,7 @@ public interface WxRentContractMapper extends CommonMapper<WxRentContract, Strin | |||||
| void updateRentInvalidStatus(WxRentContract wxRentContract); | void updateRentInvalidStatus(WxRentContract wxRentContract); | ||||
| List<WxRentContract> getRentContractList(String tenantId); | |||||
| List<WxRentContract> getRentContractList(WxRentContract tenantId); | |||||
| void updateStatusForUnsign(WxRentContract wxRentContract); | void updateStatusForUnsign(WxRentContract wxRentContract); | ||||
| @@ -30,14 +30,15 @@ public interface WxRentContractService { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| ResultData getById(Long id); | ResultData getById(Long id); | ||||
| /** | |||||
| /** | |||||
| * 保存或更新实体 | * 保存或更新实体 | ||||
| * | |||||
| * @param record | |||||
| * @param id | |||||
| */ | |||||
| ResultData save(WxRentContract record, Long userId); | |||||
| * @param record | |||||
| * @param userId | |||||
| * @param userName | |||||
| * @return | |||||
| */ | |||||
| ResultData save(WxRentContract record,Long userId,String userName); | |||||
| ResultData update(WxRentContract record, Long userId); | ResultData update(WxRentContract record, Long userId); | ||||
| @@ -57,13 +58,13 @@ public interface WxRentContractService { | |||||
| ResultData updateMerchant(WxRentContract wxRentContract); | ResultData updateMerchant(WxRentContract wxRentContract); | ||||
| Object getRentContractList(String tenantId, Integer pageNum, Integer pageSize); | |||||
| Object getRentContractList(WxRentContract rentContract, Integer pageNum, Integer pageSize); | |||||
| void exportContract(HttpServletRequest request, HttpServletResponse response, String tenantId, Long id); | void exportContract(HttpServletRequest request, HttpServletResponse response, String tenantId, Long id); | ||||
| ResultData updateFile(WxRentContract wxRentContract, Long userId); | ResultData updateFile(WxRentContract wxRentContract, Long userId); | ||||
| ResultData updateRentContractStatus(Long id, Long userId); | |||||
| ResultData updateRentContractStatus(Long id); | |||||
| void updateApplyStatus(WxRentContract wxRentContract); | void updateApplyStatus(WxRentContract wxRentContract); | ||||
| @@ -19,11 +19,9 @@ import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.data.redis.core.StringRedisTemplate; | import org.springframework.data.redis.core.StringRedisTemplate; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import java.math.BigDecimal; | import java.math.BigDecimal; | ||||
| import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
| import java.util.*; | import java.util.*; | ||||
| import java.util.concurrent.atomic.AtomicInteger; | |||||
| import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
| @@ -211,6 +211,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||||
| PageInfo<Map<String,Object>> pageInfo = new PageInfo<>(result); | PageInfo<Map<String,Object>> pageInfo = new PageInfo<>(result); | ||||
| pageInfo.setPages(pages); | pageInfo.setPages(pages); | ||||
| pageInfo.setTotal(total); | pageInfo.setTotal(total); | ||||
| PageHelper.clearPage(); | |||||
| return new ResultData(pageInfo); | return new ResultData(pageInfo); | ||||
| } | } | ||||
| @@ -173,39 +173,23 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| // + couponOrder ---待使用 | // + couponOrder ---待使用 | ||||
| int countOrder = 0, countCouponOrder = 0; | int countOrder = 0, countCouponOrder = 0; | ||||
| if(counpon.getType().equals(EnumCouponType.COUPON_PRESS.getCode())) { | |||||
| // 砍价券待支付有两个状态 | |||||
| try { | |||||
| WxOrder orderQ = new WxOrder(); | |||||
| orderQ.setTenantId(user.getTenantId()); | |||||
| orderQ.setProductId(counpon.getId()); | |||||
| orderQ.setType(EnumOrderType.COUPON.getCode()); | |||||
| orderQ.setcUserId(user.getId()); | |||||
| List<Integer> statusS = new ArrayList<Integer>(); | |||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_PRESSING.getCode()); | |||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_PRESS_COMPLETE.getCode()); | |||||
| orderQ.setStatusS(statusS); | |||||
| countOrder = wxOrderMapper.countList(orderQ); | |||||
| } catch (Exception e) { | |||||
| logger.error("购买是否超限-DB, couponId: " + counpon.getId() + ", e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | |||||
| } | |||||
| } else { | |||||
| // 非砍价券 | |||||
| try { | |||||
| WxOrder orderQ = new WxOrder(); | |||||
| orderQ.setTenantId(user.getTenantId()); | |||||
| orderQ.setProductId(counpon.getId()); | |||||
| orderQ.setType(EnumOrderType.COUPON.getCode()); | |||||
| orderQ.setcUserId(user.getId()); | |||||
| orderQ.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); | |||||
| countOrder = wxOrderMapper.countList(orderQ); | |||||
| } catch (Exception e) { | |||||
| logger.error("购买是否超限-DB, couponId: " + counpon.getId() + ", e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | |||||
| } | |||||
| } | |||||
| try { | |||||
| WxOrder orderQ = new WxOrder(); | |||||
| orderQ.setTenantId(user.getTenantId()); | |||||
| orderQ.setProductId(counpon.getId()); | |||||
| orderQ.setType(EnumOrderType.COUPON.getCode()); | |||||
| orderQ.setcUserId(user.getId()); | |||||
| List<Integer> statusS = new ArrayList<Integer>(); | |||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_PRESSING.getCode()); | |||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_PRESS_COMPLETE.getCode()); //砍价券专有状态 | |||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode());//砍价券专有状态 | |||||
| orderQ.setStatusS(statusS); | |||||
| countOrder = wxOrderMapper.countList(orderQ); | |||||
| } catch (Exception e) { | |||||
| logger.error("购买是否超限-DB, couponId: " + counpon.getId() + ", e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | |||||
| } | |||||
| try { | try { | ||||
| WxCouponOrder couponOrderQ = new WxCouponOrder(); | WxCouponOrder couponOrderQ = new WxCouponOrder(); | ||||
| @@ -13,6 +13,7 @@ import com.iformall.enums.*; | |||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.WxFlowRecordService; | import com.iformall.service.WxFlowRecordService; | ||||
| import com.iformall.service.WxFlowService; | |||||
| import com.iformall.service.WxMerchantService; | import com.iformall.service.WxMerchantService; | ||||
| import com.iformall.service.WxRentContractService; | import com.iformall.service.WxRentContractService; | ||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| @@ -86,6 +87,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| @Autowired | @Autowired | ||||
| private TaskService taskService; | private TaskService taskService; | ||||
| @Autowired | |||||
| private WxFlowService wxFlowService; | |||||
| @Override | @Override | ||||
| public Map<String, Object> listAsPage(WxRentContract record, Integer pageIndex, Integer pageSize) { | public Map<String, Object> listAsPage(WxRentContract record, Integer pageIndex, Integer pageSize) { | ||||
| Object rentContractStatusInfo = getRentContractStatusInfo(record); | Object rentContractStatusInfo = getRentContractStatusInfo(record); | ||||
| @@ -132,7 +136,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| @Transactional(rollbackFor = {Exception.class}) | @Transactional(rollbackFor = {Exception.class}) | ||||
| @Override | @Override | ||||
| public ResultData save(WxRentContract record, Long userId) { | |||||
| public ResultData save(WxRentContract record,Long userId,String userName) { | |||||
| //保存租赁合同信息 | //保存租赁合同信息 | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| record.setId(idWorker.nextId()); | record.setId(idWorker.nextId()); | ||||
| @@ -181,29 +185,26 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| return new ResultData(ErrorCode.RENT_CONTRACT_WITH_SHOP_IS_FOUND); | return new ResultData(ErrorCode.RENT_CONTRACT_WITH_SHOP_IS_FOUND); | ||||
| } | } | ||||
| wxRentContractMapper.insertSelective(record); | wxRentContractMapper.insertSelective(record); | ||||
| //建立账单 | |||||
| if (record.getMerchantId() != null && record.getStatus().equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()) | |||||
| && record.getReceivePeriod() != null && record.getDeposit() > 0 && record.getPrice() > 0) { | |||||
| WxBillRent wxBillRent = new WxBillRent(); | |||||
| wxBillRent.setMerchantId(record.getMerchantId()); | |||||
| List<Map<String, Object>> billRentList = wxBillRentMapper.queryBillRentList(wxBillRent); | |||||
| if (billRentList.size() == 0) { | |||||
| WxMerchant wxMerchant = new WxMerchant(); | |||||
| wxMerchant.setId(record.getMerchantId()); | |||||
| wxMerchant.setTenantId(record.getTenantId()); | |||||
| //租金 | |||||
| buildRent(wxMerchant, userId); | |||||
| //押金 | |||||
| buildDeposit(wxMerchant, userId); | |||||
| } | |||||
| } | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("保存租赁合同信息失败,e:" + e.getMessage()); | logger.error("保存租赁合同信息失败,e:" + e.getMessage()); | ||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | ||||
| } | } | ||||
| try { | |||||
| // 如果是补录,启动审批流 | |||||
| if(record.getMerchantId() != null && record.getFlowParams() != null){ | |||||
| record.getFlowParams().put("businessId",record.getId()); | |||||
| wxFlowService.start(record.getFlowParams(),userId,userName,record.getTenantId()); | |||||
| } | |||||
| } catch (Exception e) { | |||||
| logger.error("启动审批流失败,e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.FLOW_FAIL.getCode(), "FLOW FAILD " + e.getMessage()); | |||||
| } | |||||
| return new ResultData(Result.SUCCESS, "保存租赁合同信息成功", record); | return new ResultData(Result.SUCCESS, "保存租赁合同信息成功", record); | ||||
| } | } | ||||
| @Transactional(rollbackFor = {Exception.class}) | @Transactional(rollbackFor = {Exception.class}) | ||||
| @Override | @Override | ||||
| public ResultData update(WxRentContract record, Long userId) { | public ResultData update(WxRentContract record, Long userId) { | ||||
| @@ -235,7 +236,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| if (record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { | if (record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { | ||||
| BigDecimal hundred = new BigDecimal(100); | BigDecimal hundred = new BigDecimal(100); | ||||
| BigDecimal revenue = new BigDecimal(record.getRevenue() == null ? 0 : record.getRevenue()).divide(hundred); | BigDecimal revenue = new BigDecimal(record.getRevenue() == null ? 0 : record.getRevenue()).divide(hundred); | ||||
| BigDecimal payRatio = new BigDecimal(record.getPayRatio() == null ? 0 : record.getPayRatio()).divide(hundred); | |||||
| BigDecimal payRatio = new BigDecimal(record.getPayRatio() == null ? 0 : record.getPayRatio()).divide(new BigDecimal(10000)); | |||||
| BigDecimal price = revenue.multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN); | BigDecimal price = revenue.multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN); | ||||
| record.setPrice(price.multiply(hundred).intValue()); | record.setPrice(price.multiply(hundred).intValue()); | ||||
| } | } | ||||
| @@ -257,27 +258,10 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| return new ResultData(ErrorCode.RENT_CONTRACT_WITH_SHOP_IS_FOUND); | return new ResultData(ErrorCode.RENT_CONTRACT_WITH_SHOP_IS_FOUND); | ||||
| } | } | ||||
| wxRentContractMapper.updateByPrimaryKeySelective(record); | wxRentContractMapper.updateByPrimaryKeySelective(record); | ||||
| //建立账单 | |||||
| /*if (record.getMerchantId() != null && record.getStatus().equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()) | |||||
| && record.getReceivePeriod() != null && record.getDeposit() > 0 && record.getPrice() > 0) { | |||||
| WxBillRent wxBillRent = new WxBillRent(); | |||||
| wxBillRent.setMerchantId(record.getMerchantId()); | |||||
| List<Map<String, Object>> billRentList = wxBillRentMapper.queryBillRentList(wxBillRent); | |||||
| if (billRentList.size() == 0) { | |||||
| WxMerchant wxMerchant = new WxMerchant(); | |||||
| wxMerchant.setId(record.getMerchantId()); | |||||
| wxMerchant.setTenantId(record.getTenantId()); | |||||
| //租金 | |||||
| buildRent(wxMerchant, userId); | |||||
| //押金 | |||||
| buildDeposit(wxMerchant, userId); | |||||
| } | |||||
| }*/ | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("更新租赁合同信息失败,e:" + e.getMessage()); | logger.error("更新租赁合同信息失败,e:" + e.getMessage()); | ||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | ||||
| } | } | ||||
| // return new ResultData(Result.SUCCESS, "更新租赁合同信息成功"); | |||||
| return new ResultData(Result.SUCCESS, "保存租赁合同信息成功", wxRentContract); | return new ResultData(Result.SUCCESS, "保存租赁合同信息成功", wxRentContract); | ||||
| } | } | ||||
| @@ -610,8 +594,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public PageInfo<WxRentContract> getRentContractList(String tenantId, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxRentContractMapper.getRentContractList(tenantId)); | |||||
| public PageInfo<WxRentContract> getRentContractList(WxRentContract rentContract, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxRentContractMapper.getRentContractList(rentContract)); | |||||
| } | } | ||||
| public Map<String, Object> updateStatus(WxRentContract record) { | public Map<String, Object> updateStatus(WxRentContract record) { | ||||
| @@ -815,7 +799,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData updateRentContractStatus(Long id, Long userId) { | |||||
| public ResultData updateRentContractStatus(Long id) { | |||||
| if (id == null) { | if (id == null) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | ||||
| } | } | ||||
| @@ -840,9 +824,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| wxMerchant.setId(record.getMerchantId()); | wxMerchant.setId(record.getMerchantId()); | ||||
| wxMerchant.setTenantId(record.getTenantId()); | wxMerchant.setTenantId(record.getTenantId()); | ||||
| //租金 | //租金 | ||||
| buildRent(wxMerchant, userId); | |||||
| buildRent(wxMerchant, null); | |||||
| //押金 | //押金 | ||||
| buildDeposit(wxMerchant, userId); | |||||
| buildDeposit(wxMerchant, null); | |||||
| } | } | ||||
| } | } | ||||
| return new ResultData(Result.SUCCESS, "操作成功"); | return new ResultData(Result.SUCCESS, "操作成功"); | ||||
| @@ -168,7 +168,7 @@ | |||||
| </if> | </if> | ||||
| <if test=" null != levelEndScore"> | <if test=" null != levelEndScore"> | ||||
| and poins <= #{levelEndScore} | |||||
| and poins < #{levelEndScore} | |||||
| </if> | </if> | ||||
| <if test=" null == levelStartScore and null == levelEndScore"> | <if test=" null == levelStartScore and null == levelEndScore"> | ||||
| @@ -15,6 +15,7 @@ | |||||
| <result column="merchant_name" jdbcType="VARCHAR" property="merchantName" /> | <result column="merchant_name" jdbcType="VARCHAR" property="merchantName" /> | ||||
| <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory"/> | <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory"/> | ||||
| <result column="inventory" jdbcType="INTEGER" property="inventory"/> | <result column="inventory" jdbcType="INTEGER" property="inventory"/> | ||||
| <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity"/> | |||||
| <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate"/> | <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate"/> | ||||
| <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate"/> | <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate"/> | ||||
| </resultMap> | </resultMap> | ||||
| @@ -28,7 +29,7 @@ | |||||
| else | else | ||||
| '[多商户通用]' | '[多商户通用]' | ||||
| end) as merchant_name, | end) as merchant_name, | ||||
| c.remain_inventory, c.inventory, c.valid_start_date, c.valid_end_date | |||||
| c.remain_inventory, c.use_limit_quantity, c.inventory, c.valid_start_date, c.valid_end_date | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -38,6 +38,7 @@ | |||||
| <result column="apply_status" jdbcType="INTEGER" property="applyStatus"/> | <result column="apply_status" jdbcType="INTEGER" property="applyStatus"/> | ||||
| <result column="bank_name" jdbcType="VARCHAR" property="bankName"/> | <result column="bank_name" jdbcType="VARCHAR" property="bankName"/> | ||||
| <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | ||||
| <result column="way" jdbcType="INTEGER" property="way"/> | |||||
| </resultMap> | </resultMap> | ||||
| @@ -46,9 +47,10 @@ | |||||
| `tenant_id`,`filepath`,`status`,`contract_number`,`deposit`,`pay_date`,`is_del`,`merchant_name`, | `tenant_id`,`filepath`,`status`,`contract_number`,`deposit`,`pay_date`,`is_del`,`merchant_name`, | ||||
| `brand`,`business_id`,`shop_type`,`shop_id`,`updatetime`,`createtime`,`link_person`,`link_phone`, | `brand`,`business_id`,`shop_type`,`shop_id`,`updatetime`,`createtime`,`link_person`,`link_phone`, | ||||
| `pay_account`,`filename`,`lease`,`type`,`revenue`,`adjust_ratio`,`adjust_period`,`pay_ratio`, | `pay_account`,`filename`,`lease`,`type`,`revenue`,`adjust_ratio`,`adjust_period`,`pay_ratio`, | ||||
| `start_date`,`end_date`,`apply_status`,`bank_name`,`rent_shop_type` | |||||
| `start_date`,`end_date`,`apply_status`,`bank_name`,`rent_shop_type`,`way` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| where 1 = 1 | where 1 = 1 | ||||
| <if test=" null != id ">and `id` = #{id}</if> | <if test=" null != id ">and `id` = #{id}</if> | ||||
| @@ -81,6 +83,7 @@ | |||||
| <if test=" null != startDate ">and `start_date` = #{startDate}</if> | <if test=" null != startDate ">and `start_date` = #{startDate}</if> | ||||
| <if test=" null != endDate ">and `end_date` = #{endDate}</if> | <if test=" null != endDate ">and `end_date` = #{endDate}</if> | ||||
| <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | ||||
| <if test=" null != way ">and `way` = #{way}</if> | |||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | and id in | ||||
| @@ -104,7 +107,7 @@ | |||||
| rc.lease,rc.filepath,rc.filename,rc.pay_account payAccount,rc.sign_date signDate,rc.merchant_id merchantId,rc.type, | rc.lease,rc.filepath,rc.filename,rc.pay_account payAccount,rc.sign_date signDate,rc.merchant_id merchantId,rc.type, | ||||
| rc.start_date startDate,rc.end_date endDate,br.`name` brandName,rc.apply_status applyStatus,rc.bank_name | rc.start_date startDate,rc.end_date endDate,br.`name` brandName,rc.apply_status applyStatus,rc.bank_name | ||||
| bankName, | bankName, | ||||
| rc.rent_shop_type rentShopType | |||||
| rc.rent_shop_type rentShopType,rc.way | |||||
| from wx_rent_contract rc | from wx_rent_contract rc | ||||
| left join wx_shop s on rc.shop_id=s.id | left join wx_shop s on rc.shop_id=s.id | ||||
| left join wx_mall_floor f on s.floor=f.id | left join wx_mall_floor f on s.floor=f.id | ||||
| @@ -118,6 +121,7 @@ | |||||
| <if test=" null != shopId ">and rc.`shop_id` = #{shopId}</if> | <if test=" null != shopId ">and rc.`shop_id` = #{shopId}</if> | ||||
| <if test=" null != type ">and rc.`type` = #{type}</if> | <if test=" null != type ">and rc.`type` = #{type}</if> | ||||
| <if test=" null != rentShopType ">and rc.`rent_shop_type` = #{rentShopType}</if> | <if test=" null != rentShopType ">and rc.`rent_shop_type` = #{rentShopType}</if> | ||||
| <if test=" null != way ">and rc.`way` = #{way}</if> | |||||
| </where> | </where> | ||||
| order by rc.id desc | order by rc.id desc | ||||
| @@ -174,13 +178,14 @@ | |||||
| )s) and status=1 and status!=7 and tenant_id=#{tenantId} | )s) and status=1 and status!=7 and tenant_id=#{tenantId} | ||||
| </update> | </update> | ||||
| <select id="getRentContractList" parameterType="String" resultType="com.iformall.domain.po.WxRentContract"> | |||||
| <select id="getRentContractList" parameterType="com.iformall.domain.po.WxRentContract" | |||||
| resultType="com.iformall.domain.po.WxRentContract"> | |||||
| select rc.*,s.shop_number,b.building_name building, f.floor_name floor from wx_rent_contract rc | select rc.*,s.shop_number,b.building_name building, f.floor_name floor from wx_rent_contract rc | ||||
| left join wx_shop s on rc.shop_id=s.id | left join wx_shop s on rc.shop_id=s.id | ||||
| left join wx_mall_building b on s.building=b.id | left join wx_mall_building b on s.building=b.id | ||||
| left join wx_mall_floor f on s.floor=f.id | left join wx_mall_floor f on s.floor=f.id | ||||
| where rc.status not in(1,5,6,7) and rc.tenant_id=#{tenantId} | where rc.status not in(1,5,6,7) and rc.tenant_id=#{tenantId} | ||||
| <if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if> | |||||
| <if test=" null != rentShopType ">and rc.rent_shop_type = #{rentShopType}</if> | |||||
| order by id desc | order by id desc | ||||
| </select> | </select> | ||||