# Conflicts: # mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.javarelease_toaliyun_real
| @@ -6,9 +6,7 @@ import com.iformall.common.ResultData; | |||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.MallUserInfo; | import com.iformall.domain.po.MallUserInfo; | ||||
| import com.iformall.domain.po.WxBillProperty; | import com.iformall.domain.po.WxBillProperty; | ||||
| import com.iformall.domain.po.WxBillRent; | |||||
| import com.iformall.domain.po.WxPropertyContract; | import com.iformall.domain.po.WxPropertyContract; | ||||
| import com.iformall.domain.po.WxRentContract; | |||||
| import com.iformall.enums.EnumRentStartType; | import com.iformall.enums.EnumRentStartType; | ||||
| import com.iformall.mapper.WxPropertyContractMapper; | import com.iformall.mapper.WxPropertyContractMapper; | ||||
| import com.iformall.service.WxBillPropertyService; | import com.iformall.service.WxBillPropertyService; | ||||
| @@ -22,7 +20,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.Date; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| /** | /** | ||||
| @@ -44,6 +42,7 @@ public class WxPropertyContractController 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)}) | ||||
| @SystemControllerLog(description = "物业合同-列表") | |||||
| public ResultData list(@ModelAttribute WxPropertyContract wxPropertyContract, Integer pageNum, Integer pageSize) { | public ResultData list(@ModelAttribute WxPropertyContract wxPropertyContract, Integer pageNum, Integer pageSize) { | ||||
| logger.debug("[" + getIpAddr() + "] WxPropertyContractController::list"); | logger.debug("[" + getIpAddr() + "] WxPropertyContractController::list"); | ||||
| if (null == wxPropertyContract) { | if (null == wxPropertyContract) { | ||||
| @@ -55,12 +54,17 @@ public class WxPropertyContractController extends BaseController { | |||||
| } | } | ||||
| @PostMapping("add") | @PostMapping("add") | ||||
| @SystemControllerLog(description = "物业合同-新增") | |||||
| public ResultData add(@RequestBody WxPropertyContract wxPropertyContract) { | public ResultData add(@RequestBody WxPropertyContract wxPropertyContract) { | ||||
| logger.debug("[" + getIpAddr() + "] WxPropertyContractController::add"); | logger.debug("[" + getIpAddr() + "] WxPropertyContractController::add"); | ||||
| MallUserInfo user = getUser(); | MallUserInfo user = getUser(); | ||||
| wxPropertyContract.setTenantId(user.getTenantId()); | wxPropertyContract.setTenantId(user.getTenantId()); | ||||
| wxPropertyContract.setAdjustPeriodHandle(); | wxPropertyContract.setAdjustPeriodHandle(); | ||||
| return wxPropertyContractService.saveOrUpdate(wxPropertyContract, user.getId(), user.getName()); | |||||
| if(wxPropertyContract.getRentStartType()!=null && wxPropertyContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ | |||||
| wxPropertyContract.setRentalStartDate(wxPropertyContract.getStartDate()); | |||||
| } | |||||
| return wxPropertyContractService.saveOrUpdate(wxPropertyContract, user.getId(), user.getName(),0); | |||||
| } | } | ||||
| @PostMapping("updateRentStartTime") | @PostMapping("updateRentStartTime") | ||||
| @@ -77,21 +81,23 @@ public class WxPropertyContractController extends BaseController { | |||||
| MallUserInfo user = getUser(); | MallUserInfo user = getUser(); | ||||
| propertyContract.setTenantId(user.getTenantId()); | propertyContract.setTenantId(user.getTenantId()); | ||||
| propertyContract.setAdjustPeriodHandle(); | propertyContract.setAdjustPeriodHandle(); | ||||
| return wxPropertyContractService.saveOrUpdate(propertyContract, user.getId(), user.getName()); | |||||
| return wxPropertyContractService.saveOrUpdate(propertyContract, user.getId(), user.getName(),1); | |||||
| } | } | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| @SystemControllerLog(description = "物业合同-修改") | |||||
| public ResultData update(@RequestBody WxPropertyContract wxPropertyContract) { | public ResultData update(@RequestBody WxPropertyContract wxPropertyContract) { | ||||
| logger.debug("[" + getIpAddr() + "] WxPropertyContractController::update"); | logger.debug("[" + getIpAddr() + "] WxPropertyContractController::update"); | ||||
| MallUserInfo user = getUser(); | MallUserInfo user = getUser(); | ||||
| wxPropertyContract.setTenantId(user.getTenantId()); | wxPropertyContract.setTenantId(user.getTenantId()); | ||||
| wxPropertyContract.setAdjustPeriodHandle(); | wxPropertyContract.setAdjustPeriodHandle(); | ||||
| return wxPropertyContractService.saveOrUpdate(wxPropertyContract, user.getId(), user.getName()); | |||||
| return wxPropertyContractService.saveOrUpdate(wxPropertyContract, user.getId(), user.getName(),0); | |||||
| } | } | ||||
| @GetMapping("/del") | @GetMapping("/del") | ||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | ||||
| @SystemControllerLog(description = "物业合同-删除") | |||||
| public ResultData delete(Long id) { | public ResultData delete(Long id) { | ||||
| logger.debug("[" + getIpAddr() + "] WxPropertyContractController::delete"); | logger.debug("[" + getIpAddr() + "] WxPropertyContractController::delete"); | ||||
| wxPropertyContractService.deleteById(id); | wxPropertyContractService.deleteById(id); | ||||
| @@ -100,6 +106,7 @@ public class WxPropertyContractController extends BaseController { | |||||
| @GetMapping("/findById") | @GetMapping("/findById") | ||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | ||||
| @SystemControllerLog(description = "物业合同-根据ID查询") | |||||
| public ResultData findById(Long id) { | public ResultData findById(Long id) { | ||||
| logger.debug("[" + getIpAddr() + "] WxPropertyContractController::findById"); | logger.debug("[" + getIpAddr() + "] WxPropertyContractController::findById"); | ||||
| WxBillProperty wxBillProperty = new WxBillProperty(); | WxBillProperty wxBillProperty = new WxBillProperty(); | ||||
| @@ -109,12 +116,14 @@ public class WxPropertyContractController extends BaseController { | |||||
| } | } | ||||
| @RequestMapping("/download") | @RequestMapping("/download") | ||||
| @SystemControllerLog(description = "物业合同-下载") | |||||
| public void download(HttpServletRequest request, HttpServletResponse response) { | public void download(HttpServletRequest request, HttpServletResponse response) { | ||||
| logger.debug("[" + getIpAddr() + "] WxPropertyContractController::download"); | logger.debug("[" + getIpAddr() + "] WxPropertyContractController::download"); | ||||
| wxPropertyContractService.download(request, response, getTenantId()); | wxPropertyContractService.download(request, response, getTenantId()); | ||||
| } | } | ||||
| @GetMapping("/getPropertyContractStatusInfo") | @GetMapping("/getPropertyContractStatusInfo") | ||||
| @SystemControllerLog(description = "物业合同-状态信息") | |||||
| public ResultData getPropertyContractStatusInfo(@ModelAttribute WxPropertyContract wxPropertyContract) { | public ResultData getPropertyContractStatusInfo(@ModelAttribute WxPropertyContract wxPropertyContract) { | ||||
| logger.debug("[" + getIpAddr() + "] WxPropertyContractController::getPropertyContractStatusInfo"); | logger.debug("[" + getIpAddr() + "] WxPropertyContractController::getPropertyContractStatusInfo"); | ||||
| wxPropertyContract.setTenantId(getTenantId()); | wxPropertyContract.setTenantId(getTenantId()); | ||||
| @@ -123,12 +132,14 @@ public class WxPropertyContractController extends BaseController { | |||||
| @GetMapping("/endPropertyContract") | @GetMapping("/endPropertyContract") | ||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | ||||
| @SystemControllerLog(description = "物业合同-终止") | |||||
| public ResultData endRentContract(Long id) { | public ResultData endRentContract(Long id) { | ||||
| logger.debug("[" + getIpAddr() + "] WxPropertyContractController::endRentContract"); | logger.debug("[" + getIpAddr() + "] WxPropertyContractController::endRentContract"); | ||||
| return wxPropertyContractService.endRentContract(id); | return wxPropertyContractService.endRentContract(id); | ||||
| } | } | ||||
| @GetMapping("/getRentContractList") | @GetMapping("/getRentContractList") | ||||
| @SystemControllerLog(description = "物业合同-查询列表") | |||||
| public ResultData getRentContractList(@ModelAttribute WxPropertyContract wxPropertyContract) { | public ResultData getRentContractList(@ModelAttribute WxPropertyContract wxPropertyContract) { | ||||
| logger.debug("[" + getIpAddr() + "] WxPropertyContractController::getRentContractList"); | logger.debug("[" + getIpAddr() + "] WxPropertyContractController::getRentContractList"); | ||||
| wxPropertyContract.setTenantId(getTenantId()); | wxPropertyContract.setTenantId(getTenantId()); | ||||
| @@ -137,6 +148,7 @@ public class WxPropertyContractController extends BaseController { | |||||
| @GetMapping("/endPropertyContractByRentContractId") | @GetMapping("/endPropertyContractByRentContractId") | ||||
| @ApiImplicitParam(name = "rentContractId", value = "rentContractId", dataType = "Long", paramType = "query", required = true) | @ApiImplicitParam(name = "rentContractId", value = "rentContractId", dataType = "Long", paramType = "query", required = true) | ||||
| @SystemControllerLog(description = "物业合同-根据租赁合同终止") | |||||
| public ResultData endPropertyContractByRentContractId(Long rentContractId) { | public ResultData endPropertyContractByRentContractId(Long rentContractId) { | ||||
| logger.debug("[" + getIpAddr() + "] WxPropertyContractController::endPropertyContractByRentContractId"); | logger.debug("[" + getIpAddr() + "] WxPropertyContractController::endPropertyContractByRentContractId"); | ||||
| return wxPropertyContractService.endPropertyContractByRentContractId(rentContractId); | return wxPropertyContractService.endPropertyContractByRentContractId(rentContractId); | ||||
| @@ -144,6 +156,7 @@ public class WxPropertyContractController extends BaseController { | |||||
| @GetMapping("/hasRentContract") | @GetMapping("/hasRentContract") | ||||
| @ApiImplicitParam(name = "rentContractId", value = "rentContractId", dataType = "Long", paramType = "query", required = true) | @ApiImplicitParam(name = "rentContractId", value = "rentContractId", dataType = "Long", paramType = "query", required = true) | ||||
| @SystemControllerLog(description = "物业合同-是否存在相关的租赁合同") | |||||
| public ResultData hasRentContract(Long rentContractId) { | public ResultData hasRentContract(Long rentContractId) { | ||||
| logger.debug("[" + getIpAddr() + "] WxPropertyContractController::hasRentContract"); | logger.debug("[" + getIpAddr() + "] WxPropertyContractController::hasRentContract"); | ||||
| return wxPropertyContractService.hasRentContract(rentContractId); | return wxPropertyContractService.hasRentContract(rentContractId); | ||||
| @@ -151,6 +164,7 @@ public class WxPropertyContractController extends BaseController { | |||||
| @GetMapping("updatePropertyContractStatus") | @GetMapping("updatePropertyContractStatus") | ||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | ||||
| @SystemControllerLog(description = "物业合同-更新合同状态") | |||||
| public ResultData updatePropertyContractStatus(Long id) { | public ResultData updatePropertyContractStatus(Long id) { | ||||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::updateRentContractStatus"); | logger.debug("[" + getIpAddr() + "] WxRentContractController::updateRentContractStatus"); | ||||
| return wxPropertyContractService.updatePropertyContractStatus(id); | return wxPropertyContractService.updatePropertyContractStatus(id); | ||||
| @@ -89,10 +89,11 @@ public class WxRentContractController extends BaseController { | |||||
| MallUserInfo user = getUser(); | MallUserInfo user = getUser(); | ||||
| wxRentContract.setTenantId(user.getTenantId()); | wxRentContract.setTenantId(user.getTenantId()); | ||||
| wxRentContract.setAdjustPeriodHandle(); | wxRentContract.setAdjustPeriodHandle(); | ||||
| Date oldDate = wxRentContract.getRentalStartDate(); | |||||
| if(wxRentContract.getRentStartType()!=null &&wxRentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ | if(wxRentContract.getRentStartType()!=null &&wxRentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ | ||||
| wxRentContract.setRentalStartDate(wxRentContract.getStartDate()); | wxRentContract.setRentalStartDate(wxRentContract.getStartDate()); | ||||
| } | } | ||||
| return wxRentContractService.save(wxRentContract, user.getId(),user.getName()); | |||||
| return wxRentContractService.save(wxRentContract, user.getId(),user.getName(),oldDate); | |||||
| } | } | ||||
| @PostMapping("updateRentStartTime") | @PostMapping("updateRentStartTime") | ||||
| @@ -101,7 +102,7 @@ public class WxRentContractController extends BaseController { | |||||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::updateRentStartTime"); | logger.debug("[" + getIpAddr() + "] WxRentContractController::updateRentStartTime"); | ||||
| WxRentContract rentContract = wxRentContractMapper.selectByPrimaryKey(wxRentContract.getId()); | WxRentContract rentContract = wxRentContractMapper.selectByPrimaryKey(wxRentContract.getId()); | ||||
| rentContract.setRentalStartDate(wxRentContract.getRentalStartDate()); | rentContract.setRentalStartDate(wxRentContract.getRentalStartDate()); | ||||
| Date oldDate = wxRentContract.getRentalStartDate(); | |||||
| if(wxRentContract.getRentStartType()!=null && wxRentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ | if(wxRentContract.getRentStartType()!=null && wxRentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ | ||||
| rentContract.setRentalStartDate(rentContract.getStartDate()); | rentContract.setRentalStartDate(rentContract.getStartDate()); | ||||
| } | } | ||||
| @@ -109,7 +110,7 @@ public class WxRentContractController extends BaseController { | |||||
| rentContract.setTenantId(user.getTenantId()); | rentContract.setTenantId(user.getTenantId()); | ||||
| rentContract.setAdjustPeriodHandle(); | rentContract.setAdjustPeriodHandle(); | ||||
| rentContract.setRentPriceHandle(); | rentContract.setRentPriceHandle(); | ||||
| return wxRentContractService.update(rentContract, user.getId(),user.getName()); | |||||
| return wxRentContractService.update(rentContract, user.getId(),user.getName(),1,oldDate); | |||||
| } | } | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| @@ -120,10 +121,11 @@ public class WxRentContractController extends BaseController { | |||||
| wxRentContract.setTenantId(user.getTenantId()); | wxRentContract.setTenantId(user.getTenantId()); | ||||
| wxRentContract.setAdjustPeriodHandle(); | wxRentContract.setAdjustPeriodHandle(); | ||||
| wxRentContract.setRentPriceHandle(); | wxRentContract.setRentPriceHandle(); | ||||
| Date oldDate = wxRentContract.getRentalStartDate(); | |||||
| if(wxRentContract.getRentStartType()!=null && wxRentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ | if(wxRentContract.getRentStartType()!=null && wxRentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ | ||||
| wxRentContract.setRentalStartDate(wxRentContract.getStartDate()); | wxRentContract.setRentalStartDate(wxRentContract.getStartDate()); | ||||
| } | } | ||||
| return wxRentContractService.update(wxRentContract, user.getId(),user.getName()); | |||||
| return wxRentContractService.update(wxRentContract, user.getId(),user.getName(),0,oldDate); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -139,11 +141,11 @@ public class WxRentContractController extends BaseController { | |||||
| wxRentContract.setTenantId(user.getTenantId()); | wxRentContract.setTenantId(user.getTenantId()); | ||||
| wxRentContract.setAdjustPeriodHandle(); | wxRentContract.setAdjustPeriodHandle(); | ||||
| wxRentContract.setRentPriceHandle(); | wxRentContract.setRentPriceHandle(); | ||||
| Date oldDate = wxRentContract.getRentalStartDate(); | |||||
| if(wxRentContract.getRentStartType()!=null &&wxRentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ | if(wxRentContract.getRentStartType()!=null &&wxRentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ | ||||
| wxRentContract.setRentalStartDate(wxRentContract.getStartDate()); | wxRentContract.setRentalStartDate(wxRentContract.getStartDate()); | ||||
| } | } | ||||
| return wxRentContractService.update(wxRentContract, user.getId(),user.getName()); | |||||
| return wxRentContractService.update(wxRentContract, user.getId(),user.getName(),0,oldDate); | |||||
| } | } | ||||
| @PostMapping("updateFile") | @PostMapping("updateFile") | ||||
| @@ -154,10 +156,11 @@ public class WxRentContractController extends BaseController { | |||||
| wxRentContract.setTenantId(user.getTenantId()); | wxRentContract.setTenantId(user.getTenantId()); | ||||
| wxRentContract.setAdjustPeriodHandle(); | wxRentContract.setAdjustPeriodHandle(); | ||||
| wxRentContract.setRentPriceHandle(); | wxRentContract.setRentPriceHandle(); | ||||
| Date oldDate = wxRentContract.getRentalStartDate(); | |||||
| if(wxRentContract.getRentStartType()!=null && wxRentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ | if(wxRentContract.getRentStartType()!=null && wxRentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ | ||||
| wxRentContract.setRentalStartDate(wxRentContract.getStartDate()); | wxRentContract.setRentalStartDate(wxRentContract.getStartDate()); | ||||
| } | } | ||||
| return wxRentContractService.updateFile(wxRentContract, user.getId(),user.getName()); | |||||
| return wxRentContractService.updateFile(wxRentContract, user.getId(),user.getName(),oldDate); | |||||
| } | } | ||||
| @GetMapping("/del") | @GetMapping("/del") | ||||
| @@ -40,7 +40,7 @@ public interface WxPropertyContractService { | |||||
| * @param userId | * @param userId | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| ResultData saveOrUpdate(WxPropertyContract record, Long userId,String userName); | |||||
| ResultData saveOrUpdate(WxPropertyContract record, Long userId,String userName,int from); | |||||
| /** | /** | ||||
| * 根据Id删除实体 | * 根据Id删除实体 | ||||
| @@ -8,6 +8,7 @@ import io.swagger.models.auth.In; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.util.Date; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| @@ -41,9 +42,9 @@ public interface WxRentContractService { | |||||
| * @param userName | * @param userName | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| ResultData save(WxRentContract record,Long userId,String userName); | |||||
| ResultData save(WxRentContract record,Long userId,String userName,Date oldRentStartDate); | |||||
| ResultData update(WxRentContract record, Long userId,String userName); | |||||
| ResultData update(WxRentContract record, Long userId,String userName,int from,Date oldRentStartDate); | |||||
| /** | /** | ||||
| * 根据Id删除实体 | * 根据Id删除实体 | ||||
| @@ -65,7 +66,7 @@ public interface WxRentContractService { | |||||
| 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,String userName); | |||||
| ResultData updateFile(WxRentContract wxRentContract, Long userId,String userName,Date oldRentStartDate); | |||||
| ResultData updateRentContractStatus(Long id); | ResultData updateRentContractStatus(Long id); | ||||
| @@ -200,7 +200,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| @Override | @Override | ||||
| @Transactional(rollbackFor = {Exception.class}) | @Transactional(rollbackFor = {Exception.class}) | ||||
| public ResultData saveOrUpdate(WxPropertyContract record, Long userId,String userName) { | |||||
| public ResultData saveOrUpdate(WxPropertyContract record, Long userId,String userName,int from) { | |||||
| // 保存调整金额(预账单调整) | // 保存调整金额(预账单调整) | ||||
| boolean haspreview = false; | boolean haspreview = false; | ||||
| if(!CollectionUtils.isEmpty(record.getPreviewBillRentList())){ | if(!CollectionUtils.isEmpty(record.getPreviewBillRentList())){ | ||||
| @@ -289,7 +289,9 @@ 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); | ||||
| } | } | ||||
| record.setRentalStartDate(wxRentContract.getRentalStartDate()); | |||||
| if(from != 1){ | |||||
| record.setRentalStartDate(wxRentContract.getRentalStartDate()); | |||||
| } | |||||
| record.setRentalEndDate(wxRentContract.getRentalEndDate()); | record.setRentalEndDate(wxRentContract.getRentalEndDate()); | ||||
| record.setStartDate(wxRentContract.getStartDate()); | record.setStartDate(wxRentContract.getStartDate()); | ||||
| record.setEndDate(wxRentContract.getEndDate()); | record.setEndDate(wxRentContract.getEndDate()); | ||||
| @@ -246,7 +246,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| @Transactional(rollbackFor = {Exception.class}) | @Transactional(rollbackFor = {Exception.class}) | ||||
| @Override | @Override | ||||
| public ResultData save(WxRentContract record,Long userId,String userName) { | |||||
| public ResultData save(WxRentContract record,Long userId,String userName,Date oldRentStartDate) { | |||||
| //保存租赁合同信息 | //保存租赁合同信息 | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| record.setId(idWorker.nextId()); | record.setId(idWorker.nextId()); | ||||
| @@ -343,7 +343,11 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| try { | try { | ||||
| record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); | record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); | ||||
| Date tempDate = record.getRentalStartDate(); | |||||
| record.setRentalStartDate(oldRentStartDate); | |||||
| wxRentContractMapper.insertSelective(record); | wxRentContractMapper.insertSelective(record); | ||||
| record.setRentalStartDate(tempDate); | |||||
| } 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()); | ||||
| @@ -378,7 +382,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| @Transactional(rollbackFor = {Exception.class}) | @Transactional(rollbackFor = {Exception.class}) | ||||
| @Override | @Override | ||||
| public ResultData update(WxRentContract record, Long userId,String userName) { | |||||
| public ResultData update(WxRentContract record, Long userId,String userName,int from,Date oldRentStartDate) { | |||||
| //查询预账单用于展示 | //查询预账单用于展示 | ||||
| WxBillRent wxBillRent = new WxBillRent(); | WxBillRent wxBillRent = new WxBillRent(); | ||||
| wxBillRent.setRentContractId(record.getId()); | wxBillRent.setRentContractId(record.getId()); | ||||
| @@ -387,7 +391,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| List<WxBillRent> resultList = wxBillRentMapper.findList(wxBillRent); | List<WxBillRent> resultList = wxBillRentMapper.findList(wxBillRent); | ||||
| //更新 | //更新 | ||||
| ResultData resultData = getResultDataForUpdate(record, userId); | |||||
| ResultData resultData = getResultDataForUpdate(record, userId,from,oldRentStartDate); | |||||
| if (resultData.code != Result.SUCCESS) { | if (resultData.code != Result.SUCCESS) { | ||||
| return resultData; | return resultData; | ||||
| } | } | ||||
| @@ -428,7 +432,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| return new ResultData(wxRentContract); | return new ResultData(wxRentContract); | ||||
| } | } | ||||
| public ResultData getResultDataForUpdate(WxRentContract record, Long userId) { | |||||
| public ResultData getResultDataForUpdate(WxRentContract record, Long userId,int from,Date oldRentStartDate) { | |||||
| //更新租赁合同信息 | //更新租赁合同信息 | ||||
| WxRentContract wxRentContract = wxRentContractMapper.selectByPrimaryKey(record.getId()); | WxRentContract wxRentContract = wxRentContractMapper.selectByPrimaryKey(record.getId()); | ||||
| if (wxRentContract == null) { | if (wxRentContract == null) { | ||||
| @@ -441,20 +445,23 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| instance.add(dayType, record.getLease()); | instance.add(dayType, record.getLease()); | ||||
| instance.add(Calendar.DAY_OF_MONTH, -1); | instance.add(Calendar.DAY_OF_MONTH, -1); | ||||
| if (record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { | |||||
| BigDecimal hundred = new BigDecimal(100); | |||||
| BigDecimal revenue = new BigDecimal(record.getRevenue() == null ? 0 : record.getRevenue()).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); | |||||
| record.setPrice(price.multiply(hundred).longValue()); | |||||
| } else { | |||||
| if (StringUtils.isNotEmpty(record.getPriceStr())) { | |||||
| record.setPrice(new BigDecimal(record.getPriceStr()).multiply(new BigDecimal(100)).longValue()); | |||||
| if(from != 1){ | |||||
| if (record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { | |||||
| BigDecimal hundred = new BigDecimal(100); | |||||
| BigDecimal revenue = new BigDecimal(record.getRevenue() == null ? 0 : record.getRevenue()).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); | |||||
| record.setPrice(price.multiply(hundred).longValue()); | |||||
| } else { | } else { | ||||
| record.setPrice(0L); | |||||
| if (StringUtils.isNotEmpty(record.getPriceStr())) { | |||||
| record.setPrice(new BigDecimal(record.getPriceStr()).multiply(new BigDecimal(100)).longValue()); | |||||
| } else { | |||||
| record.setPrice(0L); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| if (StringUtils.isNotEmpty(record.getDepositStr())) { | if (StringUtils.isNotEmpty(record.getDepositStr())) { | ||||
| record.setDeposit(new BigDecimal(record.getDepositStr()).multiply(new BigDecimal(100)).longValue()); | record.setDeposit(new BigDecimal(record.getDepositStr()).multiply(new BigDecimal(100)).longValue()); | ||||
| } else { | } else { | ||||
| @@ -519,7 +526,10 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| } | } | ||||
| try { | try { | ||||
| Date tempDate = record.getRentalStartDate(); | |||||
| record.setRentalStartDate(oldRentStartDate); | |||||
| wxRentContractMapper.updateByPrimaryKeySelective(record); | wxRentContractMapper.updateByPrimaryKeySelective(record); | ||||
| record.setRentalStartDate(tempDate); | |||||
| } 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()); | ||||
| @@ -1247,14 +1257,14 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| @Override | @Override | ||||
| @Transactional(rollbackFor = {Exception.class}) | @Transactional(rollbackFor = {Exception.class}) | ||||
| public ResultData updateFile(WxRentContract record, Long userId,String userName) { | |||||
| public ResultData updateFile(WxRentContract record, Long userId,String userName,Date oldRentStartDate) { | |||||
| // 保存调整金额(预账单调整) | // 保存调整金额(预账单调整) | ||||
| if(!CollectionUtils.isEmpty(record.getPreviewBillRentList())){ | if(!CollectionUtils.isEmpty(record.getPreviewBillRentList())){ | ||||
| for (WxBillRent wxBillRent:record.getPreviewBillRentList()) { | for (WxBillRent wxBillRent:record.getPreviewBillRentList()) { | ||||
| wxBillRentMapper.update(wxBillRent); | wxBillRentMapper.update(wxBillRent); | ||||
| } | } | ||||
| } | } | ||||
| ResultData resultData = getResultDataForUpdate(record, userId); | |||||
| ResultData resultData = getResultDataForUpdate(record, userId,0,oldRentStartDate); | |||||
| if (resultData.code != Result.SUCCESS) { | if (resultData.code != Result.SUCCESS) { | ||||
| return resultData; | return resultData; | ||||
| } | } | ||||