| @@ -7,9 +7,13 @@ import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.WxBillRent; | import com.iformall.domain.po.WxBillRent; | ||||
| import com.iformall.domain.po.WxPayAccountBill; | import com.iformall.domain.po.WxPayAccountBill; | ||||
| import com.iformall.domain.po.WxRentContract; | import com.iformall.domain.po.WxRentContract; | ||||
| import com.iformall.domain.po.WxShop; | |||||
| import com.iformall.enums.EnumRentShopType; | |||||
| import com.iformall.enums.EnumShopType; | |||||
| import com.iformall.service.WxBillRentService; | import com.iformall.service.WxBillRentService; | ||||
| import com.iformall.service.WxPayAccountBillService; | import com.iformall.service.WxPayAccountBillService; | ||||
| import com.iformall.service.WxRentContractService; | import com.iformall.service.WxRentContractService; | ||||
| import com.iformall.service.WxShopService; | |||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| @@ -35,9 +39,10 @@ public class WxRentContractController extends BaseController { | |||||
| private WxRentContractService wxRentContractService; | private WxRentContractService wxRentContractService; | ||||
| @Autowired | @Autowired | ||||
| private WxBillRentService wxBillRentService; | private WxBillRentService wxBillRentService; | ||||
| @Autowired | @Autowired | ||||
| private WxPayAccountBillService payAccountBillService; | private WxPayAccountBillService payAccountBillService; | ||||
| @Autowired | |||||
| private WxShopService wxShopService; | |||||
| @GetMapping("list") | @GetMapping("list") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @@ -59,7 +64,11 @@ 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()); | ||||
| if(wxRentContract.getMonthHandleType() != null){ | |||||
| //目前只有多经点位租赁合同 | |||||
| WxShop wxShop = wxShopService.getById(wxRentContract.getShopId()); | |||||
| if(wxRentContract.getMonthHandleType() != null && wxRentContract.getMonthHandleType().intValue()==3 | |||||
| && EnumRentShopType.POINT.getCode().equals(wxShop.getType())){ | |||||
| wxRentContract.setAdjustPeriod(wxRentContract.getMonthHandleType()); | wxRentContract.setAdjustPeriod(wxRentContract.getMonthHandleType()); | ||||
| } | } | ||||
| return wxRentContractService.save(wxRentContract, getUser().getId(),getUser().getName()); | return wxRentContractService.save(wxRentContract, getUser().getId(),getUser().getName()); | ||||
| @@ -70,7 +79,10 @@ public class WxRentContractController extends BaseController { | |||||
| public ResultData update(@RequestBody WxRentContract wxRentContract) { | public ResultData update(@RequestBody WxRentContract wxRentContract) { | ||||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::update"); | logger.debug("[" + getIpAddr() + "] WxRentContractController::update"); | ||||
| wxRentContract.setTenantId(getTenantId()); | wxRentContract.setTenantId(getTenantId()); | ||||
| if(wxRentContract.getMonthHandleType() != null){ | |||||
| //目前只有多经点位租赁合同 | |||||
| WxShop wxShop = wxShopService.getById(wxRentContract.getShopId()); | |||||
| if(wxRentContract.getMonthHandleType() != null && wxRentContract.getMonthHandleType().intValue()==3 | |||||
| && EnumRentShopType.POINT.getCode().equals(wxShop.getType())){ | |||||
| wxRentContract.setAdjustPeriod(wxRentContract.getMonthHandleType()); | wxRentContract.setAdjustPeriod(wxRentContract.getMonthHandleType()); | ||||
| } | } | ||||
| return wxRentContractService.update(wxRentContract, getUser().getId(),getUser().getName()); | return wxRentContractService.update(wxRentContract, getUser().getId(),getUser().getName()); | ||||
| @@ -81,7 +93,10 @@ public class WxRentContractController extends BaseController { | |||||
| public ResultData updateMoney(@RequestBody WxRentContract wxRentContract) { | public ResultData updateMoney(@RequestBody WxRentContract wxRentContract) { | ||||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::updateMoney"); | logger.debug("[" + getIpAddr() + "] WxRentContractController::updateMoney"); | ||||
| wxRentContract.setTenantId(getTenantId()); | wxRentContract.setTenantId(getTenantId()); | ||||
| if(wxRentContract.getMonthHandleType() != null){ | |||||
| //目前只有多经点位租赁合同 | |||||
| WxShop wxShop = wxShopService.getById(wxRentContract.getShopId()); | |||||
| if(wxRentContract.getMonthHandleType() != null && wxRentContract.getMonthHandleType().intValue()==3 | |||||
| && EnumRentShopType.POINT.getCode().equals(wxShop.getType())){ | |||||
| wxRentContract.setAdjustPeriod(wxRentContract.getMonthHandleType()); | wxRentContract.setAdjustPeriod(wxRentContract.getMonthHandleType()); | ||||
| } | } | ||||
| return wxRentContractService.update(wxRentContract, getUser().getId(),getUser().getName()); | return wxRentContractService.update(wxRentContract, getUser().getId(),getUser().getName()); | ||||
| @@ -92,7 +107,10 @@ public class WxRentContractController extends BaseController { | |||||
| public ResultData updateFile(@RequestBody WxRentContract wxRentContract) { | public ResultData updateFile(@RequestBody WxRentContract wxRentContract) { | ||||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::updateFile"); | logger.debug("[" + getIpAddr() + "] WxRentContractController::updateFile"); | ||||
| wxRentContract.setTenantId(getTenantId()); | wxRentContract.setTenantId(getTenantId()); | ||||
| if(wxRentContract.getMonthHandleType() != null){ | |||||
| //目前只有多经点位租赁合同 | |||||
| WxShop wxShop = wxShopService.getById(wxRentContract.getShopId()); | |||||
| if(wxRentContract.getMonthHandleType() != null && wxRentContract.getMonthHandleType().intValue()==3 | |||||
| && EnumRentShopType.POINT.getCode().equals(wxShop.getType())){ | |||||
| wxRentContract.setAdjustPeriod(wxRentContract.getMonthHandleType()); | wxRentContract.setAdjustPeriod(wxRentContract.getMonthHandleType()); | ||||
| } | } | ||||
| return wxRentContractService.updateFile(wxRentContract, getUser().getId(),getUser().getName()); | return wxRentContractService.updateFile(wxRentContract, getUser().getId(),getUser().getName()); | ||||
| @@ -57,4 +57,6 @@ public interface WxRentContractMapper extends CommonMapper<WxRentContract, Long> | |||||
| int hasContractNumber(WxRentContract wxRentContract); | int hasContractNumber(WxRentContract wxRentContract); | ||||
| Integer getShopType(WxRentContract wxRentContract); | |||||
| } | } | ||||
| @@ -83,4 +83,5 @@ public interface WxRentContractService { | |||||
| ResultData hasContractNumber(WxRentContract wxRentContract); | ResultData hasContractNumber(WxRentContract wxRentContract); | ||||
| Integer getShopType(WxRentContract wxRentContract); | |||||
| } | } | ||||
| @@ -137,13 +137,15 @@ public class PushLimitServiceImpl implements PushLimitService { | |||||
| throw new MallinkException(ErrorCode.PUSH_LIMIT_UP_TO_1DAYLIMIT.getCode(), errMsg); | throw new MallinkException(ErrorCode.PUSH_LIMIT_UP_TO_1DAYLIMIT.getCode(), errMsg); | ||||
| } | } | ||||
| // 4. check 每人多少天内不会重复收到一张券 | // 4. check 每人多少天内不会重复收到一张券 | ||||
| params.put("couponId", couponId); | |||||
| params.put("dayNum", pushLimit.getCouponDay()-1); | |||||
| int countForUserCoupon = wxCouponActionLogMapper.getCountByUserAndCoupon(params); | |||||
| if (countForUserCoupon >= 1) { | |||||
| String errMsg = "每人" + pushLimit.getCouponDay() + "天领一张券已到疲劳度上限"; | |||||
| logger.error(errMsg); | |||||
| throw new MallinkException(ErrorCode.PUSH_LIMIT_UP_TO_COUPONLIMIT.getCode(), errMsg); | |||||
| if (pushLimit.getCouponDay() > 0) { | |||||
| params.put("couponId", couponId); | |||||
| params.put("dayNum", pushLimit.getCouponDay()-1); | |||||
| int countForUserCoupon = wxCouponActionLogMapper.getCountByUserAndCoupon(params); | |||||
| if (countForUserCoupon >= 1) { | |||||
| String errMsg = "每人" + pushLimit.getCouponDay() + "天领一张券已到疲劳度上限"; | |||||
| logger.error(errMsg); | |||||
| throw new MallinkException(ErrorCode.PUSH_LIMIT_UP_TO_COUPONLIMIT.getCode(), errMsg); | |||||
| } | |||||
| } | } | ||||
| return true; | return true; | ||||
| @@ -309,7 +309,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| wxPropertyContract.setDeposit(record.getDeposit()); | wxPropertyContract.setDeposit(record.getDeposit()); | ||||
| wxPropertyContract.setReceivePeriod(record.getReceivePeriod()); | wxPropertyContract.setReceivePeriod(record.getReceivePeriod()); | ||||
| wxPropertyContract.setPayAccount(record.getPayAccount()); | wxPropertyContract.setPayAccount(record.getPayAccount()); | ||||
| billList = buildProperty(new WxMerchant(),userId,wxPropertyContract,EnumIsPreview.YES.getCode()); | |||||
| billList = buildProperty(new WxMerchant(),userId,record,EnumIsPreview.YES.getCode()); | |||||
| record.setPreviewBillRentList(billList); | record.setPreviewBillRentList(billList); | ||||
| } | } | ||||
| } | } | ||||
| @@ -13,10 +13,7 @@ import com.iformall.domain.po.*; | |||||
| import com.iformall.enums.*; | 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.WxFlowService; | |||||
| import com.iformall.service.WxMerchantService; | |||||
| import com.iformall.service.WxRentContractService; | |||||
| import com.iformall.service.*; | |||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| import org.apache.commons.collections.map.HashedMap; | import org.apache.commons.collections.map.HashedMap; | ||||
| @@ -98,6 +95,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| @Autowired | @Autowired | ||||
| WxMerchantShopMapper wxMerchantShopMapper; | WxMerchantShopMapper wxMerchantShopMapper; | ||||
| @Autowired | |||||
| WxShopService wxShopService; | |||||
| @Override | @Override | ||||
| public Map<String, Object> listAsPage(WxRentContract record, Integer pageIndex, Integer pageSize) { | public Map<String, Object> listAsPage(WxRentContract record, Integer pageIndex, Integer pageSize) { | ||||
| @@ -127,17 +126,23 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| } | } | ||||
| wxRentContract.setPrice(wxRentContract.getPrice() != null ? wxRentContract.getPrice() : 0); | wxRentContract.setPrice(wxRentContract.getPrice() != null ? wxRentContract.getPrice() : 0); | ||||
| wxRentContract.setDeposit(wxRentContract.getDeposit() != null ? wxRentContract.getDeposit() : 0); | wxRentContract.setDeposit(wxRentContract.getDeposit() != null ? wxRentContract.getDeposit() : 0); | ||||
| //handle adjustPeriod 1日 2月 monthHandleType 2按账单周期 3按自然月 | |||||
| if(wxRentContract.getAdjustPeriod().intValue() == 1){ | |||||
| wxRentContract.setAdjustPeriod(1); | |||||
| wxRentContract.setMonthHandleType(null); | |||||
| }else if(wxRentContract.getAdjustPeriod().intValue() == 2){ | |||||
| wxRentContract.setAdjustPeriod(2); | |||||
| wxRentContract.setMonthHandleType(2); | |||||
| }else if(wxRentContract.getAdjustPeriod().intValue() == 3){ | |||||
| wxRentContract.setAdjustPeriod(2); | |||||
| wxRentContract.setMonthHandleType(3); | |||||
| //目前只有多经点位租赁合同 | |||||
| WxShop wxShop = wxShopService.getById(wxRentContract.getShopId()); | |||||
| if(EnumRentShopType.POINT.getCode().equals(wxShop.getType())){ | |||||
| //handle adjustPeriod 1日 2月 monthHandleType 2按账单周期 3按自然月 | |||||
| if(wxRentContract.getAdjustPeriod().intValue() == 1){ | |||||
| wxRentContract.setAdjustPeriod(1); | |||||
| wxRentContract.setMonthHandleType(null); | |||||
| }else if(wxRentContract.getAdjustPeriod().intValue() == 2){ | |||||
| wxRentContract.setAdjustPeriod(2); | |||||
| wxRentContract.setMonthHandleType(2); | |||||
| }else if(wxRentContract.getAdjustPeriod().intValue() == 3){ | |||||
| wxRentContract.setAdjustPeriod(2); | |||||
| wxRentContract.setMonthHandleType(3); | |||||
| } | |||||
| } | } | ||||
| result.put("wxRentContract", wxRentContract); | result.put("wxRentContract", wxRentContract); | ||||
| //关联的商户 | //关联的商户 | ||||
| if (wxRentContract.getMerchantId() != null) { | if (wxRentContract.getMerchantId() != null) { | ||||
| @@ -2032,6 +2037,10 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| wxRentContractMapper.updateApplyStatus(wxRentContract); | wxRentContractMapper.updateApplyStatus(wxRentContract); | ||||
| } | } | ||||
| @Override | |||||
| public Integer getShopType(WxRentContract wxRentContract) { | |||||
| return wxRentContractMapper.getShopType(wxRentContract); | |||||
| } | |||||
| } | } | ||||
| @@ -28,7 +28,7 @@ | |||||
| (case when | (case when | ||||
| (select count(*) from wx_coupon_merchant xcm where xcm.product_id = cs.coupon_id and xcm.status = 0)=1 | (select count(*) from wx_coupon_merchant xcm where xcm.product_id = cs.coupon_id and xcm.status = 0)=1 | ||||
| then | then | ||||
| (select m.name from wx_merchant m, wx_coupon_merchant cm where m.id = cm.merchant_id and cm.product_id=cs.coupon_id) | |||||
| (select m.name from wx_merchant m, wx_coupon_merchant cm where m.id = cm.merchant_id and cm.product_id=cs.coupon_id and cm.status = 0) | |||||
| else | else | ||||
| '[多商户通用]' | '[多商户通用]' | ||||
| end) as merchant_name, | end) as merchant_name, | ||||
| @@ -271,5 +271,10 @@ | |||||
| </where> | </where> | ||||
| </select> | </select> | ||||
| <select id="getShopType" parameterType="com.iformall.domain.po.WxRentContract" resultType="int"> | |||||
| select s.type from wx_rent_contract r left join wx_shop s on(s.id = r.`shop_id`) | |||||
| where r.id = #{id} | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||