Просмотр исходного кода

[合同][修改][按店铺类型查询业务]

release_toaliyun_real
gongbiao 7 лет назад
Родитель
Сommit
49427bcc10
9 измененных файлов: 88 добавлений и 50 удалений
  1. +6
    -4
      mallinkAdmin/src/main/java/com/iformall/controller/WxPropertyContractController.java
  2. +3
    -2
      mallinkAdmin/src/main/java/com/iformall/controller/WxRentContractController.java
  3. +11
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java
  4. +2
    -2
      mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java
  5. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxRentContractService.java
  6. +27
    -25
      mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java
  7. +11
    -9
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java
  8. +15
    -4
      mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml
  9. +12
    -3
      mallinkService/src/main/resources/mapper/WxRentContractMapper.xml

+ 6
- 4
mallinkAdmin/src/main/java/com/iformall/controller/WxPropertyContractController.java Просмотреть файл

@@ -77,9 +77,10 @@ public class WxPropertyContractController extends BaseController
}

@GetMapping("/getPropertyContractStatusInfo")
public ResultData getPropertyContractStatusInfo() {
public ResultData getPropertyContractStatusInfo(@ModelAttribute WxPropertyContract wxPropertyContract) {
logger.debug("[" + getIpAddr() + "] WxPropertyContractController::getPropertyContractStatusInfo");
return new ResultData(Result.SUCCESS, "查询成功", wxPropertyContractService.getRentContractStatusInfo(getTenantId()));
wxPropertyContract.setTenantId(getTenantId());
return new ResultData(Result.SUCCESS, "查询成功", wxPropertyContractService.getRentContractStatusInfo(wxPropertyContract));
}

@GetMapping("/endPropertyContract")
@@ -90,9 +91,10 @@ public class WxPropertyContractController extends BaseController
}

@GetMapping("/getRentContractList")
public ResultData getRentContractList() {
public ResultData getRentContractList(@ModelAttribute WxPropertyContract wxPropertyContract) {
logger.debug("[" + getIpAddr() + "] WxPropertyContractController::getRentContractList");
return new ResultData(Result.SUCCESS, "查询成功", wxPropertyContractService.getRentContractList(getTenantId()));
wxPropertyContract.setTenantId(getTenantId());
return new ResultData(Result.SUCCESS, "查询成功", wxPropertyContractService.getRentContractList(wxPropertyContract));
}

@GetMapping("/endPropertyContractByRentContractId")


+ 3
- 2
mallinkAdmin/src/main/java/com/iformall/controller/WxRentContractController.java Просмотреть файл

@@ -90,9 +90,10 @@ public class WxRentContractController extends BaseController {
}

@GetMapping("/getRentContractStatusInfo")
public ResultData getRentContractStatusInfo() {
public ResultData getRentContractStatusInfo(@ModelAttribute WxRentContract wxRentContract) {
logger.debug("[" + getIpAddr() + "] WxRentContractController::getRentContractStatusInfo");
return new ResultData(Result.SUCCESS, "查询成功", wxRentContractService.getRentContractStatusInfo(getTenantId()));
wxRentContract.setTenantId(getTenantId());
return new ResultData(Result.SUCCESS, "查询成功", wxRentContractService.getRentContractStatusInfo(wxRentContract));
}

@GetMapping("/endRentContract")


+ 11
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java Просмотреть файл

@@ -153,6 +153,9 @@ public class WxPropertyContract implements Serializable {
@io.swagger.annotations.ApiModelProperty(value = "起租结束时间", name = "rentalEndDate")
private Date endDate;

@io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType")
private Integer rentShopType;

public Integer getApplyStatus() {
return applyStatus;
}
@@ -340,6 +343,14 @@ public class WxPropertyContract implements Serializable {
this.endDate = endDate;
}

public Integer getRentShopType() {
return rentShopType;
}

public void setRentShopType(Integer rentShopType) {
this.rentShopType = rentShopType;
}

public static enum Field
{
Id_ASC("`id` ASC"),Id_DESC("`id` DESC")


+ 2
- 2
mallinkService/src/main/java/com/iformall/service/WxPropertyContractService.java Просмотреть файл

@@ -47,11 +47,11 @@ public interface WxPropertyContractService {

void download(HttpServletRequest request, HttpServletResponse response, String tenantId);

Object getRentContractStatusInfo(String tenantId);
Object getRentContractStatusInfo(WxPropertyContract record);

ResultData endRentContract(Long id);

Object getRentContractList(String tenantId);
Object getRentContractList(WxPropertyContract record);


ResultData endPropertyContractByRentContractId(Long rentContractId);


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxRentContractService.java Просмотреть файл

@@ -51,7 +51,7 @@ public interface WxRentContractService {

void download(HttpServletRequest request, HttpServletResponse response, String tenantId);

Object getRentContractStatusInfo(String tenantId);
Object getRentContractStatusInfo(WxRentContract record);

ResultData endRentContract(Long id, Integer status);



+ 27
- 25
mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java Просмотреть файл

@@ -55,7 +55,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService

@Override
public Map<String, Object> listAsPage(WxPropertyContract record, Integer pageIndex, Integer pageSize) {
Object rentContractStatusInfo = getRentContractStatusInfo(record.getTenantId());
Object rentContractStatusInfo = getRentContractStatusInfo(record);
PageHelper.startPage(pageIndex, pageSize);
List<Map<String, Object>> rentContractData = wxPropertyContractMapper.queryPropertyContractData(record);
PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(rentContractData);
@@ -416,12 +416,13 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService

@Transactional(rollbackFor = {Exception.class})
@Override
public Object getRentContractStatusInfo(String tenantId) {
public Object getRentContractStatusInfo(WxPropertyContract record) {

Map<String, Object> resultData = new HashMap();
//商铺信息
WxShop wxShop = new WxShop();
wxShop.setTenantId(tenantId);
wxShop.setTenantId(record.getTenantId());
wxShop.setType(record.getRentShopType());
wxShop.setStatus(EnumShopStatus.RENT.getCode());
List<WxShop> rentedList = wxShopMapper.findList(wxShop);
wxShop.setStatus(EnumShopStatus.NOT_RENT.getCode());
@@ -436,7 +437,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
resultData.put("shopCountInfo", shopMap);

//需要更新的状态
resultData.putAll(updateStatus(tenantId));
resultData.putAll(updateStatus(record));
return resultData;
}

@@ -461,9 +462,10 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService


@Override
public Object getRentContractList(String tenantId) {
public Object getRentContractList(WxPropertyContract record) {
Map<String, Object> params = new HashMap<>();
params.put("tenantId", tenantId);
params.put("tenantId", record.getTenantId());
params.put("rentShopType", record.getRentShopType());
return wxPropertyContractMapper.getRentContractList(params);
}

@@ -511,41 +513,41 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
return new ResultData(false);
}

public Map<String, Object> updateStatus(String tenantId) {
public Map<String, Object> updateStatus(WxPropertyContract record) {
Map<String, Object> resultData = new HashMap();
WxPropertyContract wxRentContract = new WxPropertyContract();
wxRentContract.setTenantId(tenantId);
WxPropertyContract wxPropertyContract = new WxPropertyContract();
wxPropertyContract.setTenantId(record.getTenantId());
wxPropertyContract.setRentShopType(record.getRentShopType());

int allCount = wxPropertyContractMapper.selectCount(wxRentContract);
int allCount = wxPropertyContractMapper.selectCount(wxPropertyContract);
resultData.put("allCount", allCount);

//作废合同
wxRentContract.setStatus(EnumRentContractStatus.INVALID.getCode());
wxPropertyContractMapper.updateRentInvalidStatus(wxRentContract);
wxPropertyContract.setStatus(EnumRentContractStatus.INVALID.getCode());
wxPropertyContractMapper.updateRentInvalidStatus(wxPropertyContract);

//待签约
wxRentContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode());
wxPropertyContractMapper.updateRentWaitSignStatus(wxRentContract);
int waitSignCount = wxPropertyContractMapper.queryRentContractWaitSignStatus(wxRentContract);
wxPropertyContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode());
wxPropertyContractMapper.updateRentWaitSignStatus(wxPropertyContract);
int waitSignCount = wxPropertyContractMapper.queryRentContractWaitSignStatus(wxPropertyContract);
resultData.put("waitSignCount", waitSignCount);

//计租中
wxRentContract.setStatus(EnumRentContractStatus.RENT_PAID.getCode());
int rendPaidCount = wxPropertyContractMapper.queryRentContractPaidStatus(wxRentContract);
wxPropertyContractMapper.updateRentContractPaidStatus(wxRentContract);
wxPropertyContract.setStatus(EnumRentContractStatus.RENT_PAID.getCode());
int rendPaidCount = wxPropertyContractMapper.queryRentContractPaidStatus(wxPropertyContract);
wxPropertyContractMapper.updateRentContractPaidStatus(wxPropertyContract);
resultData.put("rendPaidCount", rendPaidCount);

//将到期
wxRentContract.setStatus(EnumRentContractStatus.CONTRACT_END_SOON.getCode());
int endSoonCount = wxPropertyContractMapper.queryRentContractEndSoonStatus(wxRentContract);
wxPropertyContractMapper.updateRentContractEndSoonStatus(wxRentContract);
wxPropertyContract.setStatus(EnumRentContractStatus.CONTRACT_END_SOON.getCode());
int endSoonCount = wxPropertyContractMapper.queryRentContractEndSoonStatus(wxPropertyContract);
wxPropertyContractMapper.updateRentContractEndSoonStatus(wxPropertyContract);
resultData.put("endSoonCount", endSoonCount);

//到期
wxRentContract.setStatus(EnumRentContractStatus.CONTRACT_END.getCode());
int endCount = wxPropertyContractMapper.queryRentContractEndStatus(wxRentContract);
wxPropertyContractMapper.updateRentContractEndStatus(wxRentContract);
wxPropertyContract.setStatus(EnumRentContractStatus.CONTRACT_END.getCode());
int endCount = wxPropertyContractMapper.queryRentContractEndStatus(wxPropertyContract);
wxPropertyContractMapper.updateRentContractEndStatus(wxPropertyContract);
resultData.put("endCount", endCount);

return resultData;


+ 11
- 9
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java Просмотреть файл

@@ -83,7 +83,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {

@Override
public Map<String, Object> listAsPage(WxRentContract record, Integer pageIndex, Integer pageSize) {
Object rentContractStatusInfo = getRentContractStatusInfo(record.getTenantId());
Object rentContractStatusInfo = getRentContractStatusInfo(record);
PageHelper.startPage(pageIndex, pageSize);
List<Map<String, Object>> rentContractData = wxRentContractMapper.queryRentContractData(record);
PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(rentContractData);
@@ -177,7 +177,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
wxRentContractMapper.insertSelective(record);
//建立账单
/*if (record.getMerchantId() != null && record.getStatus().equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode())
if (record.getMerchantId() != null && record.getStatus().equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode())
&& record.getReceivePeriod() != null && record.getDeposit() > 0 && record.getPrice() > 0) {
WxBillRent wxBillRent = new WxBillRent();
wxBillRent.setMerchantId(record.getMerchantId());
@@ -191,7 +191,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
//押金
buildDeposit(wxMerchant, userId);
}
}*/
}
} catch (Exception e) {
logger.error("保存租赁合同信息失败,e:" + e.getMessage());
throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage());
@@ -525,12 +525,13 @@ public class WxRentContractServiceImpl implements WxRentContractService {

@Transactional(rollbackFor = {Exception.class})
@Override
public Object getRentContractStatusInfo(String tenantId) {
public Object getRentContractStatusInfo(WxRentContract rentContract) {

Map<String, Object> resultData = new HashMap();
//商铺信息
WxShop wxShop = new WxShop();
wxShop.setTenantId(tenantId);
wxShop.setTenantId(rentContract.getTenantId());
wxShop.setType(rentContract.getRentShopType());
wxShop.setStatus(EnumShopStatus.RENT.getCode());
List<WxShop> rentedList = wxShopMapper.findList(wxShop);
wxShop.setStatus(EnumShopStatus.NOT_RENT.getCode());
@@ -545,7 +546,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
resultData.put("shopCountInfo", shopMap);

//需要更新的状态
resultData.putAll(updateStatus(tenantId));
resultData.putAll(updateStatus(rentContract));
return resultData;
}

@@ -609,10 +610,11 @@ public class WxRentContractServiceImpl implements WxRentContractService {
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxRentContractMapper.getRentContractList(tenantId));
}

public Map<String, Object> updateStatus(String tenantId) {
public Map<String, Object> updateStatus(WxRentContract record) {
Map<String, Object> resultData = new HashMap();
WxRentContract wxRentContract = new WxRentContract();
wxRentContract.setTenantId(tenantId);
wxRentContract.setTenantId(record.getTenantId());
wxRentContract.setRentShopType(record.getRentShopType());

int allCount = wxRentContractMapper.selectCount(wxRentContract);
resultData.put("allCount", allCount);
@@ -687,7 +689,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
resultData.put("endCount", endCount);

//合同到期
contractEnd(tenantId);
contractEnd(record.getTenantId());

return resultData;
}


+ 15
- 4
mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml Просмотреть файл

@@ -77,6 +77,8 @@
<if test=" null != rentContractId ">and `rent_contract_id` = #{rentContractId}</if>
<if test=" null != startDate ">and `start_date` = #{startDate}</if>
<if test=" null != endDate ">and `end_date` = #{endDate}</if>
<if test=" null != rentShopType">and `rent_shop_type` = #{rentShopType}</if>
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
@@ -115,6 +117,8 @@
<if test=" null != status ">and rc.`status` = #{status}</if>
<if test=" null != rentContractId">and rc.`rent_contract_id` = #{rentContractId}</if>
<if test=" null != id">and rc.`id` = #{id}</if>
<if test=" null != rentShopType">and rc.`rent_shop_type` = #{rentShopType}</if>
</where>
order by rc.id desc
</select>
@@ -122,19 +126,26 @@
<select id="queryRentContractWaitSignStatus" resultType="int"
parameterType="com.iformall.domain.po.WxPropertyContract">
select count(id) from wx_property_contract where tenant_id=#{tenantId} and status=#{status}
<if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
</select>
<select id="queryRentContractEndSoonStatus" resultType="int"
parameterType="com.iformall.domain.po.WxPropertyContract">
select count(id) from wx_property_contract where tenant_id=#{tenantId} and status!=1 and status!=6 and status!=7 and DATEDIFF(rental_end_date,now()) &lt;= 30 and rental_end_date > now()
select count(id) from wx_property_contract where tenant_id=#{tenantId} and status!=1
and status!=6 and status!=7 and DATEDIFF(rental_end_date,now()) &lt;= 30 and rental_end_date > now()
<if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
</select>
<select id="queryRentContractPaidStatus" resultType="int" parameterType="com.iformall.domain.po.WxPropertyContract">
select count(id) from wx_property_contract where tenant_id=#{tenantId} and status!=1 and status!=6 and status!=7 and rental_start_date &lt;= now() and rental_end_date >= now()
select count(id) from wx_property_contract where tenant_id=#{tenantId} and status!=1 and status!=6 and status!=7
and rental_start_date &lt;= now() and rental_end_date >= now()
<if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
</select>
<select id="queryRentContractEndStatus" resultType="int" parameterType="com.iformall.domain.po.WxPropertyContract">
select count(id) from wx_property_contract where tenant_id=#{tenantId} and status!=1 and status!=6 and status!=7 and rental_end_date &lt;now()
select count(id) from wx_property_contract where tenant_id=#{tenantId}
and status!=1 and status!=6 and status!=7 and rental_end_date &lt;now()
<if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
</select>
<update id="updateRentContractEndSoonStatus" parameterType="com.iformall.domain.po.WxPropertyContract">
@@ -165,7 +176,7 @@
and rc.id not in (select pc.rent_contract_id from (
select rent_contract_id from wx_property_contract where status not in(1,5,6,7) and tenant_id=#{tenantId}
) pc)
<if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
</select>

<update id="updateApplyStatus" parameterType="com.iformall.domain.po.WxPropertyContract">


+ 12
- 3
mallinkService/src/main/resources/mapper/WxRentContractMapper.xml Просмотреть файл

@@ -125,18 +125,26 @@
<select id="queryRentContractWaitSignStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract">
select count(id) from wx_rent_contract where tenant_id=#{tenantId} and status=#{status}
<if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
</select>
<select id="queryRentContractEndSoonStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract">
select count(id) from wx_rent_contract where tenant_id=#{tenantId} and status!=1 and status!=6 and status!=7 and DATEDIFF(rental_end_date,now()) &lt;= 30 and rental_end_date > now()
select count(id) from wx_rent_contract where tenant_id=#{tenantId} and status!=1 and status!=6
and status!=7 and DATEDIFF(rental_end_date,now()) &lt;= 30 and rental_end_date > now()
<if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
</select>
<select id="queryRentContractPaidStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract">
select count(id) from wx_rent_contract where tenant_id=#{tenantId} and status!=1 and status!=6 and status!=7 and rental_start_date &lt;= now() and rental_end_date >= now()
select count(id) from wx_rent_contract where tenant_id=#{tenantId} and status!=1 and status!=6 and status!=7
and rental_start_date &lt;= now() and rental_end_date >= now()
<if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
</select>
<select id="queryRentContractEndStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract">
select count(id) from wx_rent_contract where tenant_id=#{tenantId} and status!=1 and status!=6 and status!=7 and rental_end_date &lt;now()
select count(id) from wx_rent_contract where tenant_id=#{tenantId} and status!=1 and status!=6 and status!=7
and rental_end_date &lt;now()
<if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
</select>
<update id="updateRentContractEndSoonStatus" parameterType="com.iformall.domain.po.WxRentContract">
@@ -172,6 +180,7 @@
left join wx_mall_building b on s.building=b.id
left join wx_mall_floor f on s.floor=f.id
where rc.status not in(1,5,6,7) and rc.tenant_id=#{tenantId}
<if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
order by id desc
</select>


Загрузка…
Отмена
Сохранить