| @@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.*; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.text.SimpleDateFormat; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| /** | /** | ||||
| @@ -258,27 +258,11 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| if (count > 0) { | if (count > 0) { | ||||
| return new ResultData(ErrorCode.RENT_CONTRACT_WITH_SHOP_IS_FOUND); | return new ResultData(ErrorCode.RENT_CONTRACT_WITH_SHOP_IS_FOUND); | ||||
| } | } | ||||
| int dayType = record.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode()) ? Calendar.DAY_OF_MONTH : Calendar.MONTH; | |||||
| //保存物业合同信息 | //保存物业合同信息 | ||||
| String message; | String message; | ||||
| if (record.getId() == null) { | if (record.getId() == null) { | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| record.setId(idWorker.nextId()); | record.setId(idWorker.nextId()); | ||||
| // //计租开始时间 | |||||
| // Calendar instance = Calendar.getInstance(); | |||||
| // instance.setTime(record.getRentalStartDate()); | |||||
| // instance.add(dayType, record.getLease()); | |||||
| // instance.add(Calendar.DAY_OF_MONTH, -1); | |||||
| // record.setRentalEndDate(instance.getTime()); | |||||
| // //起租结束时间 | |||||
| // if(!record.getStartDate().equals(record.getRentalStartDate())){ | |||||
| // instance.clear(); | |||||
| // instance.setTime(record.getRentalStartDate()); | |||||
| // instance.add(Calendar.DAY_OF_MONTH, -1); | |||||
| // record.setEndDate(instance.getTime()); | |||||
| // }else{ | |||||
| // record.setEndDate(record.getStartDate()); | |||||
| // } | |||||
| record.setRentalStartDate(wxRentContract.getRentalStartDate()); | record.setRentalStartDate(wxRentContract.getRentalStartDate()); | ||||
| record.setRentalEndDate(wxRentContract.getRentalEndDate()); | record.setRentalEndDate(wxRentContract.getRentalEndDate()); | ||||
| record.setStartDate(wxRentContract.getStartDate()); | record.setStartDate(wxRentContract.getStartDate()); | ||||
| @@ -307,20 +291,6 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| if (wxPropertyContract == null) { | if (wxPropertyContract == null) { | ||||
| return new ResultData(ErrorCode.PROPERTY_CONTRACT_IS_NOT_FOUND); | return new ResultData(ErrorCode.PROPERTY_CONTRACT_IS_NOT_FOUND); | ||||
| } | } | ||||
| // Calendar instance = Calendar.getInstance(); | |||||
| // instance.setTime(record.getRentalStartDate()); | |||||
| // instance.add(dayType, record.getLease()); | |||||
| // instance.add(Calendar.DAY_OF_MONTH, -1); | |||||
| // record.setRentalEndDate(instance.getTime()); | |||||
| // //起租结束时间 | |||||
| // if(!record.getStartDate().equals(record.getRentalStartDate())){ | |||||
| // instance.clear(); | |||||
| // instance.setTime(record.getRentalStartDate()); | |||||
| // instance.add(Calendar.DAY_OF_MONTH, -1); | |||||
| // record.setEndDate(instance.getTime()); | |||||
| // }else{ | |||||
| // record.setEndDate(record.getStartDate()); | |||||
| // } | |||||
| record.setRentalStartDate(wxRentContract.getRentalStartDate()); | record.setRentalStartDate(wxRentContract.getRentalStartDate()); | ||||
| record.setRentalEndDate(wxRentContract.getRentalEndDate()); | record.setRentalEndDate(wxRentContract.getRentalEndDate()); | ||||
| record.setStartDate(wxRentContract.getStartDate()); | record.setStartDate(wxRentContract.getStartDate()); | ||||
| @@ -493,12 +463,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| double priceD = price; | double priceD = price; | ||||
| for (int i = 1; i < size; i++) { | for (int i = 1; i < size; i++) { | ||||
| priceD = priceD + priceD * integers.get(i) / 10000.0; | priceD = priceD + priceD * integers.get(i) / 10000.0; | ||||
| //年 需要除12 | |||||
| if(EnumPriceUnit.Y.getCode().equals(wxPropertyContract.getPriceUnit())){ | |||||
| priceArr[i] = new BigDecimal(priceD).divide(new BigDecimal(12),2, BigDecimal.ROUND_HALF_DOWN).setScale(0, RoundingMode.HALF_EVEN).longValue(); | |||||
| }else{ | |||||
| priceArr[i] = new BigDecimal(priceD).setScale(0, RoundingMode.HALF_EVEN).longValue(); | |||||
| } | |||||
| priceArr[i] = new BigDecimal(priceD).setScale(0, RoundingMode.HALF_EVEN).longValue(); | |||||
| } | } | ||||
| int month = 12; | int month = 12; | ||||
| int divide = lease / month; | int divide = lease / month; | ||||
| @@ -554,6 +519,10 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| List<BillTimeVo> billTimeVoList = WxRentContractServiceImpl.initBillTimeList(wxPropertyContract.getRentalStartDate(),wxPropertyContract.getRentalEndDate(),wxPropertyContract.getAdjustPeriod(),dayType,receivePeriod); | List<BillTimeVo> billTimeVoList = WxRentContractServiceImpl.initBillTimeList(wxPropertyContract.getRentalStartDate(),wxPropertyContract.getRentalEndDate(),wxPropertyContract.getAdjustPeriod(),dayType,receivePeriod); | ||||
| int index = 0; | int index = 0; | ||||
| for (BillTimeVo billTimeVo : billTimeVoList){ | for (BillTimeVo billTimeVo : billTimeVoList){ | ||||
| if(sd.format(billTimeVo.getStartDate()).equals("2020-05-29")){ | |||||
| System.out.println(); | |||||
| } | |||||
| if(yearList.size() > 1) { | if(yearList.size() > 1) { | ||||
| if (endDate!=null && (sd.format(billTimeVo.getStartDate()).equals(sd.format(endDate)) || billTimeVo.getStartDate().after(endDate))) { | if (endDate!=null && (sd.format(billTimeVo.getStartDate()).equals(sd.format(endDate)) || billTimeVo.getStartDate().after(endDate))) { | ||||
| logger.info("=====billTimeVo.getStartDate():"+sd.format(billTimeVo.getStartDate())+" endDate:"+sd.format(endDate)); | logger.info("=====billTimeVo.getStartDate():"+sd.format(billTimeVo.getStartDate())+" endDate:"+sd.format(endDate)); | ||||
| @@ -98,6 +98,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| @Autowired | @Autowired | ||||
| WxMerchantShopMapper wxMerchantShopMapper; | WxMerchantShopMapper wxMerchantShopMapper; | ||||
| @Autowired | |||||
| WxFlowRecordMapper wxFlowRecordMapper; | |||||
| @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); | ||||
| @@ -671,6 +674,11 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| rentContract.setApplyStatus(EnumRentContractAppStatus.CANCLE.getCode()); | rentContract.setApplyStatus(EnumRentContractAppStatus.CANCLE.getCode()); | ||||
| updateApplyStatus(rentContract); | updateApplyStatus(rentContract); | ||||
| //修改flowRecord | |||||
| WxFlowRecord fr = new WxFlowRecord(); | |||||
| fr.setBusinessId(id); | |||||
| wxFlowRecordMapper.updateCurrStatus(fr); | |||||
| logger.info("合同id:{},开始停止...", id); | logger.info("合同id:{},开始停止...", id); | ||||
| //结束审批流 by luozukai | //结束审批流 by luozukai | ||||
| List<Task> tasks = taskService.createTaskQuery().processDefinitionKey(WxFlowServiceImpl.getFlowKeyByType(1)) | List<Task> tasks = taskService.createTaskQuery().processDefinitionKey(WxFlowServiceImpl.getFlowKeyByType(1)) | ||||
| @@ -751,13 +759,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| long[] priceArr = new long[arraySize]; | long[] priceArr = new long[arraySize]; | ||||
| for (int i = 0; i < arraySize; i++) { | for (int i = 0; i < arraySize; i++) { | ||||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | ||||
| //年 需要除12 | |||||
| if(EnumPriceUnit.Y.getCode().equals(priceUnit)){ | |||||
| BigDecimal yprice = new BigDecimal(rentInfoObject.getString("price")).divide(new BigDecimal(12),2, BigDecimal.ROUND_HALF_DOWN); | |||||
| priceArr[i] = yprice.multiply(new BigDecimal(100)).longValue(); | |||||
| }else{ | |||||
| priceArr[i] = new BigDecimal(rentInfoObject.getString("price")).multiply(new BigDecimal(100)).longValue(); | |||||
| } | |||||
| priceArr[i] = new BigDecimal(rentInfoObject.getString("price")).multiply(new BigDecimal(100)).longValue(); | |||||
| } | } | ||||
| priceList.add(priceArr); | priceList.add(priceArr); | ||||
| //大于一年 | //大于一年 | ||||
| @@ -1823,8 +1825,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| public static void main(String[] args) throws Exception{ | public static void main(String[] args) throws Exception{ | ||||
| long tprice = 100; | long tprice = 100; | ||||
| SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); | SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); | ||||
| Date start = sd.parse("2019-05-13"); | |||||
| Date end = sd.parse("2019-07-05"); | |||||
| Date start = sd.parse("2020-05-29"); | |||||
| Date end = sd.parse("2020-07-28"); | |||||
| System.out.println("===="+new WxRentContractServiceImpl().getNeedPay(tprice,0,start,end));; | System.out.println("===="+new WxRentContractServiceImpl().getNeedPay(tprice,0,start,end));; | ||||
| } | } | ||||
| @@ -30,6 +30,9 @@ | |||||
| <result column="pay_way" jdbcType="INTEGER" property="payWay"/> | <result column="pay_way" jdbcType="INTEGER" property="payWay"/> | ||||
| <result column="late_pay_status" jdbcType="INTEGER" property="latePayStatus"/> | <result column="late_pay_status" jdbcType="INTEGER" property="latePayStatus"/> | ||||
| <result column="comments" jdbcType="VARCHAR" property="comments"/> | <result column="comments" jdbcType="VARCHAR" property="comments"/> | ||||
| <result column="starttime" property="starttime"/> | |||||
| <result column="endtime" property="endtime"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| @@ -37,7 +40,7 @@ | |||||
| `createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`, | `createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`, | ||||
| `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type`, | `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type`, | ||||
| `revenue`,`late_pay_ratio`,`late_pay_time`,`late_pay_price`,`period`,`is_preview`,`shop_info`, | `revenue`,`late_pay_ratio`,`late_pay_time`,`late_pay_price`,`period`,`is_preview`,`shop_info`, | ||||
| `pay_way`,`late_pay_status`,`comments` | |||||
| `pay_way`,`late_pay_status`,`comments`,starttime,endtime | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -40,7 +40,7 @@ | |||||
| `createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`, | `createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`, | ||||
| `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type`, | `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type`, | ||||
| `revenue`,`late_pay_ratio`,`late_pay_time`,`late_pay_price`,`period`,`is_preview`,`shop_info`, | `revenue`,`late_pay_ratio`,`late_pay_time`,`late_pay_price`,`period`,`is_preview`,`shop_info`, | ||||
| `pay_way`,`late_pay_status`,`comments` | |||||
| `pay_way`,`late_pay_status`,`comments`,starttime,endtime | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -72,8 +72,12 @@ | |||||
| </select> | </select> | ||||
| <update id="updateCurrStatus" parameterType="com.iformall.domain.po.WxFlowRecord"> | <update id="updateCurrStatus" parameterType="com.iformall.domain.po.WxFlowRecord"> | ||||
| update wx_flow_record set curr_status=#{currStatus} where process_instance_id=#{processInstanceId} | |||||
| and status = 1 | |||||
| update wx_flow_record set curr_status=#{currStatus} | |||||
| <where> | |||||
| and status = 1 | |||||
| <if test=" null != processInstanceId ">and process_instance_id=#{processInstanceId}</if> | |||||
| <if test=" null != businessId ">and business_id = #{businessId}</if> | |||||
| </where> | |||||
| </update> | </update> | ||||
| </mapper> | </mapper> | ||||