| @@ -49,4 +49,6 @@ public interface WxRentContractMapper extends CommonMapper<WxRentContract, Long> | |||||
| int selectRentContractCountByShopId(WxRentContract wxRentContract); | int selectRentContractCountByShopId(WxRentContract wxRentContract); | ||||
| void updateInvalidContract(WxRentContract record); | |||||
| } | } | ||||
| @@ -76,4 +76,6 @@ public interface WxRentContractService { | |||||
| void buildDeposit(WxMerchant wxMerchant, Long userId,Long rentContractId); | void buildDeposit(WxMerchant wxMerchant, Long userId,Long rentContractId); | ||||
| Object getMerchants(WxRentContract wxRentContract); | Object getMerchants(WxRentContract wxRentContract); | ||||
| void updateInvalidContract(Long rentContractId); | |||||
| } | } | ||||
| @@ -353,6 +353,8 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| //wxRentContractService.buildRent(wxMerchant, userId,null,EnumIsPreview.NO.getCode()); | //wxRentContractService.buildRent(wxMerchant, userId,null,EnumIsPreview.NO.getCode()); | ||||
| //创建押金 | //创建押金 | ||||
| wxRentContractService.buildDeposit(wxMerchant, userId,wxMerchant.getRentContractId()); | wxRentContractService.buildDeposit(wxMerchant, userId,wxMerchant.getRentContractId()); | ||||
| //作废合同 | |||||
| wxRentContractService.updateInvalidContract(wxMerchant.getRentContractId()); | |||||
| } | } | ||||
| return new ResultData(Result.SUCCESS, "商户创建成功", merchantId); | return new ResultData(Result.SUCCESS, "商户创建成功", merchantId); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| @@ -155,7 +155,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| } | } | ||||
| } | } | ||||
| if (null == record.getShopId()) { | |||||
| if (record.getRentShopType().equals(EnumRentShopType.POINT.getCode()) && null == record.getShopId()) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "shopId不能为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "shopId不能为空"); | ||||
| } | } | ||||
| @@ -583,6 +583,30 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| return rentContractList; | return rentContractList; | ||||
| } | } | ||||
| @Override | |||||
| public void updateInvalidContract(Long rentContractId) { | |||||
| WxRentContract wxRentContract = wxRentContractMapper.selectByPrimaryKey(rentContractId); | |||||
| if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { | |||||
| String rentInfo = wxRentContract.getRentInfo(); | |||||
| JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); | |||||
| WxRentContract record = new WxRentContract(); | |||||
| for (int i = 0, size = rentInfoArray.size(); i < size; i++) { | |||||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | |||||
| Long shopId = rentInfoObject.getLong("shopId"); | |||||
| record.setShopId(shopId); | |||||
| record.setTenantId(wxRentContract.getTenantId()); | |||||
| record.setStatus(EnumRentContractStatus.INVALID.getCode()); | |||||
| wxRentContractMapper.updateInvalidContract(record); | |||||
| } | |||||
| } else { | |||||
| WxRentContract record = new WxRentContract(); | |||||
| record.setTenantId(wxRentContract.getTenantId()); | |||||
| record.setRentShopType(wxRentContract.getRentShopType()); | |||||
| record.setStatus(EnumRentContractStatus.INVALID.getCode()); | |||||
| wxRentContractMapper.updateRentInvalidStatus(record); | |||||
| } | |||||
| } | |||||
| @Override | @Override | ||||
| @Transactional(rollbackFor = {Exception.class}) | @Transactional(rollbackFor = {Exception.class}) | ||||
| public List<WxBillRent> buildRent(WxMerchant wxMerchant, Long userId,WxRentContract rentContract,Integer isPreview) { | public List<WxBillRent> buildRent(WxMerchant wxMerchant, Long userId,WxRentContract rentContract,Integer isPreview) { | ||||
| @@ -1050,16 +1074,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| } | } | ||||
| } | } | ||||
| //把状态为意见而商户未关联的数据改为待签约状态 | |||||
| //wxRentContractMapper.updateStatusForUnsign(wxRentContract); | |||||
| //作废合同 | |||||
| wxRentContract.setStatus(EnumRentContractStatus.INVALID.getCode()); | |||||
| wxRentContractMapper.updateRentInvalidStatus(wxRentContract); | |||||
| //待签约 | //待签约 | ||||
| wxRentContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); | wxRentContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); | ||||
| //wxRentContractMapper.updateRentWaitSignStatus(wxRentContract); | |||||
| int waitSignCount = wxRentContractMapper.queryRentContractWaitSignStatus(wxRentContract); | int waitSignCount = wxRentContractMapper.queryRentContractWaitSignStatus(wxRentContract); | ||||
| resultData.put("waitSignCount", waitSignCount); | resultData.put("waitSignCount", waitSignCount); | ||||
| @@ -1271,6 +1287,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| buildDeposit(wxMerchant, null,id); | buildDeposit(wxMerchant, null,id); | ||||
| // } | // } | ||||
| } | } | ||||
| //作废合同 | |||||
| updateInvalidContract(id); | |||||
| return new ResultData(Result.SUCCESS, "操作成功"); | return new ResultData(Result.SUCCESS, "操作成功"); | ||||
| } | } | ||||
| @@ -191,7 +191,7 @@ | |||||
| <update id="updateRentInvalidStatus" parameterType="com.iformall.domain.po.WxRentContract"> | <update id="updateRentInvalidStatus" parameterType="com.iformall.domain.po.WxRentContract"> | ||||
| update wx_rent_contract set status=#{status} where shop_id in ( | update wx_rent_contract set status=#{status} where shop_id in ( | ||||
| select s.shop_id from (SELECT shop_id FROM wx_rent_contract WHERE tenant_id = #{tenantId} and status in(2,3,4) | select s.shop_id from (SELECT shop_id FROM wx_rent_contract WHERE tenant_id = #{tenantId} and status in(2,3,4) | ||||
| )s) and status=1 and status!=7 and tenant_id=#{tenantId} and rent_shop_type=2 | |||||
| )s) and status in(0,1) and status!=7 and tenant_id=#{tenantId} and rent_shop_type=2 | |||||
| </update> | </update> | ||||
| <select id="getRentContractList" parameterType="com.iformall.domain.po.WxRentContract" | <select id="getRentContractList" parameterType="com.iformall.domain.po.WxRentContract" | ||||
| @@ -214,7 +214,7 @@ | |||||
| resultType="com.iformall.domain.po.WxRentContract"> | resultType="com.iformall.domain.po.WxRentContract"> | ||||
| select id from wx_rent_contract where shop_id in ( | select id from wx_rent_contract where shop_id in ( | ||||
| select s.shop_id from (SELECT shop_id FROM wx_rent_contract WHERE tenant_id = #{tenantId} and status in(2,3,4) | select s.shop_id from (SELECT shop_id FROM wx_rent_contract WHERE tenant_id = #{tenantId} and status in(2,3,4) | ||||
| )s) and status=1 and status!=7 and tenant_id=#{tenantId} | |||||
| )s) and status in(0,1) and status!=7 and tenant_id=#{tenantId} | |||||
| </select> | </select> | ||||
| <select id="queryOweCount" parameterType="com.iformall.domain.po.WxRentContract" resultType="Long"> | <select id="queryOweCount" parameterType="com.iformall.domain.po.WxRentContract" resultType="Long"> | ||||