| @@ -20,7 +20,6 @@ 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.util.Date; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| /** | /** | ||||
| @@ -112,7 +111,8 @@ public class WxPropertyContractController extends BaseController { | |||||
| WxBillProperty wxBillProperty = new WxBillProperty(); | WxBillProperty wxBillProperty = new WxBillProperty(); | ||||
| wxBillProperty.setTenantId(super.getTenantId()); | wxBillProperty.setTenantId(super.getTenantId()); | ||||
| wxBillPropertyService.updateBillStatus(wxBillProperty); | wxBillPropertyService.updateBillStatus(wxBillProperty); | ||||
| return wxPropertyContractService.getById(id); | |||||
| Map<String, Object> data = wxPropertyContractService.getById(id); | |||||
| return new ResultData(data); | |||||
| } | } | ||||
| @RequestMapping("/download") | @RequestMapping("/download") | ||||
| @@ -180,7 +180,8 @@ public class WxRentContractController extends BaseController { | |||||
| WxBillRent wxBillRent = new WxBillRent(); | WxBillRent wxBillRent = new WxBillRent(); | ||||
| wxBillRent.setTenantId(getTenantId()); | wxBillRent.setTenantId(getTenantId()); | ||||
| wxBillRentService.updateBillStatus(wxBillRent); | wxBillRentService.updateBillStatus(wxBillRent); | ||||
| return wxRentContractService.getById(id); | |||||
| Map<String, Object> data = wxRentContractService.getById(id); | |||||
| return new ResultData(data); | |||||
| } | } | ||||
| @RequestMapping("/download") | @RequestMapping("/download") | ||||
| @@ -8,6 +8,7 @@ import com.iformall.domain.vo.WxRentPropertyContractVo; | |||||
| import com.iformall.service.WxRentContractService; | import com.iformall.service.WxRentContractService; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -42,6 +43,15 @@ public class WxRentPropertyContractController extends BaseController { | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @ApiOperation("根据id查询接口") | |||||
| @GetMapping("/findById") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| @SystemControllerLog(description = "租赁物业合同-根据id查询接口") | |||||
| public ResultData findById(Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] wxRentPropertyContract::findById"); | |||||
| return wxRentContractService.getContractInfo(id); | |||||
| } | |||||
| } | } | ||||
| @@ -32,7 +32,7 @@ public interface WxPropertyContractService { | |||||
| * @param id | * @param id | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| ResultData getById(Long id); | |||||
| Map<String, Object> getById(Long id); | |||||
| /** | /** | ||||
| * 保存或更新实体 | * 保存或更新实体 | ||||
| @@ -35,7 +35,7 @@ public interface WxRentContractService { | |||||
| * @param id | * @param id | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| ResultData getById(Long id); | |||||
| Map<String, Object> getById(Long id); | |||||
| /** | /** | ||||
| * 保存或更新实体 | * 保存或更新实体 | ||||
| @@ -90,4 +90,6 @@ public interface WxRentContractService { | |||||
| PageInfo<WxRentPropertyContractVo> listContractVo(WxRentPropertyContractVo wxRentPropertyContractVo, Integer pageNum, Integer pageSize); | PageInfo<WxRentPropertyContractVo> listContractVo(WxRentPropertyContractVo wxRentPropertyContractVo, Integer pageNum, Integer pageSize); | ||||
| ResultData getContractInfo(Long id); | |||||
| } | } | ||||
| @@ -83,12 +83,12 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData getById(Long id) { | |||||
| public Map<String, Object> getById(Long id) { | |||||
| Map<String, Object> result = new HashMap<>(); | Map<String, Object> result = new HashMap<>(); | ||||
| WxPropertyContract wxPropertyContract = wxPropertyContractMapper.selectByPrimaryKey(id); | WxPropertyContract wxPropertyContract = wxPropertyContractMapper.selectByPrimaryKey(id); | ||||
| if (wxPropertyContract == null) { | if (wxPropertyContract == null) { | ||||
| return new ResultData(ErrorCode.PROPERTY_CONTRACT_IS_NOT_FOUND); | |||||
| throw new MallinkException(ErrorCode.PROPERTY_CONTRACT_IS_NOT_FOUND); | |||||
| } | } | ||||
| //init dateDiff | //init dateDiff | ||||
| @@ -195,7 +195,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| List<WxBillProperty> resultList = wxBillPropertyMapper.findList(wxBillRent); | List<WxBillProperty> resultList = wxBillPropertyMapper.findList(wxBillRent); | ||||
| result.put("previewBillRentList",resultList); | result.put("previewBillRentList",resultList); | ||||
| return new ResultData(Result.SUCCESS, "查询成功", result); | |||||
| return result; | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -14,10 +14,7 @@ import com.iformall.domain.vo.WxRentPropertyContractVo; | |||||
| 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.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| import com.iformall.utils.DownFileUtil; | import com.iformall.utils.DownFileUtil; | ||||
| import com.iformall.utils.PriceUtil; | import com.iformall.utils.PriceUtil; | ||||
| @@ -105,6 +102,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| @Autowired | @Autowired | ||||
| WxFlowRecordMapper wxFlowRecordMapper; | WxFlowRecordMapper wxFlowRecordMapper; | ||||
| @Autowired | |||||
| WxPropertyContractService wxPropertyContractService; | |||||
| @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); | ||||
| @@ -118,11 +118,11 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData getById(Long id) { | |||||
| public Map<String, Object> getById(Long id) { | |||||
| Map<String, Object> result = new HashMap<>(); | Map<String, Object> result = new HashMap<>(); | ||||
| WxRentContract wxRentContract = wxRentContractMapper.selectByPrimaryKey(id); | WxRentContract wxRentContract = wxRentContractMapper.selectByPrimaryKey(id); | ||||
| if (wxRentContract == null) { | if (wxRentContract == null) { | ||||
| return new ResultData(ErrorCode.RENT_CONTRACT_IS_NOT_FOUND); | |||||
| throw new MallinkException(ErrorCode.RENT_CONTRACT_IS_NOT_FOUND); | |||||
| } | } | ||||
| //init dateDiff | //init dateDiff | ||||
| @@ -242,7 +242,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| List<WxBillRent> resultList = wxBillRentMapper.findList(wxBillRent); | List<WxBillRent> resultList = wxBillRentMapper.findList(wxBillRent); | ||||
| result.put("previewBillRentList",resultList); | result.put("previewBillRentList",resultList); | ||||
| return new ResultData(Result.SUCCESS, "查询成功", result); | |||||
| return result; | |||||
| } | } | ||||
| @Transactional(rollbackFor = {Exception.class}) | @Transactional(rollbackFor = {Exception.class}) | ||||
| @@ -1841,6 +1841,26 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxRentContractMapper.listContractVo(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxRentContractMapper.listContractVo(record)); | ||||
| } | } | ||||
| @Override | |||||
| public ResultData getContractInfo(Long id) { | |||||
| Map<String, Object> data = new HashMap<>(); | |||||
| Map<String, Object> rent = getById(id); | |||||
| data.put("rent", rent); | |||||
| WxPropertyContract wxPropertyContractQuery = new WxPropertyContract(); | |||||
| wxPropertyContractQuery.setRentContractId(id); | |||||
| WxPropertyContract wxPropertyContract = wxPropertyContractMapper.select(wxPropertyContractQuery).parallelStream() | |||||
| .filter(p -> p.getStatus().equals(EnumRentContractStatus.CONTRACT_END_SOON.getCode()) || | |||||
| p.getStatus().equals(EnumRentContractStatus.RENT_PAID.getCode()) || | |||||
| p.getStatus().equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode())) | |||||
| .findFirst().orElseGet(null); | |||||
| data.put("property", wxPropertyContract); | |||||
| if (wxPropertyContract != null) { | |||||
| Map<String, Object> property = wxPropertyContractService.getById(wxPropertyContract.getRentContractId()); | |||||
| data.put("property", property); | |||||
| } | |||||
| return new ResultData(data); | |||||
| } | |||||
| public static double getMonthNeedPay(Double price,Date start,Date end){ | public static double getMonthNeedPay(Double price,Date start,Date end){ | ||||
| SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); | SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); | ||||
| SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM"); | SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM"); | ||||
| @@ -317,8 +317,8 @@ | |||||
| <select id="listContractVo" parameterType="com.iformall.domain.vo.WxRentPropertyContractVo" resultMap="contractMap"> | <select id="listContractVo" parameterType="com.iformall.domain.vo.WxRentPropertyContractVo" resultMap="contractMap"> | ||||
| select rc.id,rc.merchant_name,rc.rental_start_date,rc.rental_end_date,rc.`status`, | select rc.id,rc.merchant_name,rc.rental_start_date,rc.rental_end_date,rc.`status`, | ||||
| rc.price as rent_price,rc.contract_number,s.shop_number shopNumber, | |||||
| rc.type,rc.apply_status,rc.rent_shop_type,rc.rent_info rentInfo,pc.price as property_price | |||||
| rc.price as rent_price,rc.contract_number,s.shop_number,rc.type,rc.apply_status, | |||||
| rc.rent_shop_type,rc.rent_info,pc.price as property_price | |||||
| from wx_rent_contract rc inner join wx_property_contract pc on rc.id=pc.rent_contract_id | from wx_rent_contract rc inner join wx_property_contract pc on rc.id=pc.rent_contract_id | ||||
| left join wx_shop s on rc.shop_id=s.id | left join wx_shop s on rc.shop_id=s.id | ||||
| <where> | <where> | ||||