Kaynağa Gözat

[审批流][修改][完善账单审批]

release_toaliyun_real
luozukai 7 yıl önce
ebeveyn
işleme
2c22380547
8 değiştirilmiş dosya ile 190 ekleme ve 54 silme
  1. +22
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxShop.java
  2. +5
    -1
      mallinkService/src/main/java/com/iformall/enums/EnumChart.java
  3. +1
    -1
      mallinkService/src/main/java/com/iformall/mapper/WxShopMapper.java
  4. +53
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java
  5. +0
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java
  6. +75
    -51
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java
  7. +17
    -0
      mallinkService/src/main/java/com/iformall/utils/DateUtils.java
  8. +17
    -0
      mallinkService/src/main/resources/mapper/WxShopMapper.xml

+ 22
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxShop.java Dosyayı Görüntüle

@@ -126,6 +126,13 @@ public class WxShop implements Serializable {
@io.swagger.annotations.ApiModelProperty(value = "是否删除1是0否", name = " ") @io.swagger.annotations.ApiModelProperty(value = "是否删除1是0否", name = " ")
private Integer isDel; private Integer isDel;


//开始时间
@Transient
private Date startdate;
//结束时间
@Transient
private Date enddate;

public Integer getIsDel() { public Integer getIsDel() {
return isDel; return isDel;
} }
@@ -224,6 +231,21 @@ public class WxShop implements Serializable {
public void setUpdateDate(Date _updateDate) { public void setUpdateDate(Date _updateDate) {
updateDate = _updateDate; updateDate = _updateDate;
} }
public Date getStartdate() {
return startdate;
}

public void setStartdate(Date startdate) {
this.startdate = startdate;
}

public Date getEnddate() {
return enddate;
}

public void setEnddate(Date enddate) {
this.enddate = enddate;
}


public String getImgUrl() { public String getImgUrl() {
return imgUrl; return imgUrl;


+ 5
- 1
mallinkService/src/main/java/com/iformall/enums/EnumChart.java Dosyayı Görüntüle

@@ -53,7 +53,11 @@ public enum EnumChart {
SALE_CARD(45, "卡营销数据"), SALE_CARD(45, "卡营销数据"),
SALE_COUPON(46, "卷营销数据"), SALE_COUPON(46, "卷营销数据"),
SALE_PRESS(47, "砍价营销数据"), SALE_PRESS(47, "砍价营销数据"),
SALE_GROUP(48, "拼团营销数据"),;
SALE_GROUP(48, "拼团营销数据"),


INDEX_SHOP_RENT(49, "商铺出租数据"),
;


public static EnumChart getEnum(Integer code) { public static EnumChart getEnum(Integer code) {
for (EnumChart value : values()) { for (EnumChart value : values()) {


+ 1
- 1
mallinkService/src/main/java/com/iformall/mapper/WxShopMapper.java Dosyayı Görüntüle

@@ -31,5 +31,5 @@ public interface WxShopMapper extends CommonMapper<WxShop, String> {


List<WxShopVo> findShopVoList(Map map); List<WxShopVo> findShopVoList(Map map);


Long getCountByWxShop(WxShop wxShop);
} }

+ 53
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java Dosyayı Görüntüle

@@ -274,6 +274,11 @@ public class WxChartServiceImpl implements WxChartDataService {
return getSaleGroupAnalysis(paramsMap, tenantId, startdate); return getSaleGroupAnalysis(paramsMap, tenantId, startdate);
} }


//首页商铺出租数据
if (chart.equals(EnumChart.INDEX_SHOP_RENT.getCode())) {
return getIndexShopRentData(tenantId, startdate);
}

return new ResultData(ErrorCode.REPORT_TYPE_UNKNOWN); return new ResultData(ErrorCode.REPORT_TYPE_UNKNOWN);
} }


@@ -2191,4 +2196,52 @@ public class WxChartServiceImpl implements WxChartDataService {
return map; return map;
} }


/**
* 首页商铺出租数据
* @param tenantId
* @return
*/
private ResultData getIndexShopRentData(String tenantId, String startDateStr) {
HashMap<String, Object> datamap = new HashMap<>();
Date startDate = DateUtils.getDateFromString(startDateStr,"yyyy-MM-dd").getTime();
Date endDate = DateUtils.getLastDayForMonth(startDate);
WxShop query = new WxShop();
query.setTenantId(tenantId);
query.setStartdate(startDate);
query.setEnddate(endDate);

query.setType(null);
Long total = wxShopMapper.getCountByWxShop(query);
query.setType(EnumRentShopType.SHOP.getCode());
Long totalShop = wxShopMapper.getCountByWxShop(query);
query.setType(EnumRentShopType.POINT.getCode());
Long totalPoint = wxShopMapper.getCountByWxShop(query);

query.setType(null);
query.setStatus(EnumShopStatus.RENT.getCode());
Long rentTotal = wxShopMapper.getCountByWxShop(query);
query.setType(EnumRentShopType.SHOP.getCode());
Long rentTotalShop = wxShopMapper.getCountByWxShop(query);
query.setType(EnumRentShopType.POINT.getCode());
Long rentTotalPoint = wxShopMapper.getCountByWxShop(query);

query.setType(null);
query.setStatus(EnumShopStatus.NOT_RENT.getCode());
Long notRentTotal = wxShopMapper.getCountByWxShop(query);
query.setType(EnumRentShopType.SHOP.getCode());
Long notRentTotalShop = wxShopMapper.getCountByWxShop(query);
query.setType(EnumRentShopType.POINT.getCode());
Long notRentTotalPoint = wxShopMapper.getCountByWxShop(query);

datamap.put("total",total);
datamap.put("totalShop",totalShop);
datamap.put("totalPoint",totalPoint);
datamap.put("rentTotal",rentTotal);
datamap.put("rentTotalShop",rentTotalShop);
datamap.put("rentTotalPoint",rentTotalPoint);
datamap.put("notRentTotal",notRentTotal);
datamap.put("notRentTotalShop",notRentTotalShop);
datamap.put("notRentTotalPoint",notRentTotalPoint);
return new ResultData(datamap);
}
} }

+ 0
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java Dosyayı Görüntüle

@@ -33,7 +33,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;


+ 75
- 51
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java Dosyayı Görüntüle

@@ -321,68 +321,58 @@ public class WxRentContractServiceImpl implements WxRentContractService {
wxBillRent.setIsPreview(EnumIsPreview.YES.getCode()); wxBillRent.setIsPreview(EnumIsPreview.YES.getCode());
List<WxBillRent> resultList = wxBillRentMapper.findList(wxBillRent); List<WxBillRent> resultList = wxBillRentMapper.findList(wxBillRent);


// 更新
//更新
ResultData resultData = getResultDataForUpdate(record, userId); ResultData resultData = getResultDataForUpdate(record, userId);
if (resultData.code != Result.SUCCESS) { if (resultData.code != Result.SUCCESS) {
return resultData; return resultData;
} }


if (record.getReceivePeriod() != null && record.getLease() != null && record.getPrice() != null
&& !record.getReceivePeriod().equals(0) && !record.getLease().equals(0) && !record.getPrice().equals(0)) {
if (dbRent.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) {
//删除预账单,重新生成
wxBillRentMapper.deletePreviewBill(record);
resultList = buildRent(new WxMerchant(), null, record, EnumIsPreview.YES.getCode());
//有改变,删除预账单,重新生成
if (record.getReceivePeriod() != null && record.getLease() != null && record.getPrice() != null) {
boolean change = false;
if (CollectionUtils.isEmpty(resultList)) {
change = true;
} else if (record.getAdjustPeriod().intValue() != dbRent.getAdjustPeriod().intValue()) {
change = true;
} else { } else {
boolean change = false;
if (CollectionUtils.isEmpty(resultList)) {
change = true;
} else if (record.getAdjustPeriod().intValue() != dbRent.getAdjustPeriod().intValue()) {
change = true;
} else {
if (record.getReceivePeriod() != null && record.getLease() != null && record.getPrice() != null) {
if (record.getType().equals(EnumRentContractType.RENT_BY_AREA.getCode())) {
if (!record.getReceivePeriod().equals(dbRent.getReceivePeriod())
|| !record.getLease().equals(dbRent.getLease())
|| !record.getType().equals(dbRent.getType())
|| !record.getPrice().equals(dbRent.getPrice())
|| !record.getAdjustRatio().replaceAll("\\s*", "").equals(dbRent.getAdjustRatio().replaceAll("\\s*", ""))
|| !DateUtils.date2String(record.getRentalStartDate(), "yyyy-MM-dd").equals(DateUtils.date2String(dbRent.getRentalStartDate(), "yyyy-MM-dd"))
) {
change = true;
}
} else if (record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) {
if (!record.getReceivePeriod().equals(dbRent.getReceivePeriod())
|| !record.getLease().equals(dbRent.getLease())
|| !record.getType().equals(dbRent.getType())
|| !record.getRevenue().equals(dbRent.getRevenue())
|| !record.getPayRatio().equals(dbRent.getPayRatio())
|| !DateUtils.date2String(record.getRentalStartDate(), "yyyy-MM-dd").equals(DateUtils.date2String(dbRent.getRentalStartDate(), "yyyy-MM-dd"))
) {
change = true;
}
} else if (record.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) {
if (!record.getReceivePeriod().equals(dbRent.getReceivePeriod())
|| !record.getLease().equals(dbRent.getLease())
|| !record.getType().equals(dbRent.getType())
|| !record.getPrice().equals(dbRent.getPrice())
|| !record.getPayRatio().equals(dbRent.getPayRatio())
|| !DateUtils.date2String(record.getRentalStartDate(), "yyyy-MM-dd").equals(DateUtils.date2String(dbRent.getRentalStartDate(), "yyyy-MM-dd"))
) {
change = true;
}
}
if (record.getType().equals(EnumRentContractType.RENT_BY_AREA.getCode())) {
if (!record.getReceivePeriod().equals(dbRent.getReceivePeriod())
|| !record.getLease().equals(dbRent.getLease())
|| !record.getType().equals(dbRent.getType())
|| !record.getPrice().equals(dbRent.getPrice())
|| !record.getAdjustRatio().replaceAll("\\s*", "").equals(dbRent.getAdjustRatio().replaceAll("\\s*", ""))
|| !DateUtils.date2String(record.getRentalStartDate(),"yyyy-MM-dd").equals(DateUtils.date2String(dbRent.getRentalStartDate(),"yyyy-MM-dd"))
) {
change = true;
}
} else if (record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) {
if (!record.getReceivePeriod().equals(dbRent.getReceivePeriod())
|| !record.getLease().equals(dbRent.getLease())
|| !record.getType().equals(dbRent.getType())
|| !record.getRevenue().equals(dbRent.getRevenue())
|| !record.getPayRatio().equals(dbRent.getPayRatio())
|| !DateUtils.date2String(record.getRentalStartDate(),"yyyy-MM-dd").equals(DateUtils.date2String(dbRent.getRentalStartDate(),"yyyy-MM-dd"))
) {
change = true;
}
} else if (record.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) {
if (!record.getReceivePeriod().equals(dbRent.getReceivePeriod())
|| !record.getLease().equals(dbRent.getLease())
|| !record.getType().equals(dbRent.getType())
|| !record.getPrice().equals(dbRent.getPrice())
|| !record.getPayRatio().equals(dbRent.getPayRatio())
|| !DateUtils.date2String(record.getRentalStartDate(),"yyyy-MM-dd").equals(DateUtils.date2String(dbRent.getRentalStartDate(),"yyyy-MM-dd"))
) {
change = true;
} }
}
//有改变,删除预账单,重新生成
if (change) {
wxBillRentMapper.deletePreviewBill(record);
resultList = buildRent(new WxMerchant(), null, record, EnumIsPreview.YES.getCode());
} }
} }
if (change) {
wxBillRentMapper.deletePreviewBill(record);
resultList = buildRent(new WxMerchant(), null, record, EnumIsPreview.YES.getCode());
}
} }



//启动审批流 //启动审批流
if(record.getFlowParams() != null){ if(record.getFlowParams() != null){
record.getFlowParams().put("businessId",record.getId().toString()); record.getFlowParams().put("businessId",record.getId().toString());
@@ -1085,6 +1075,40 @@ public class WxRentContractServiceImpl implements WxRentContractService {
int allCount = wxRentContractMapper.selectCount(wxRentContract); int allCount = wxRentContractMapper.selectCount(wxRentContract);
resultData.put("allCount", allCount); resultData.put("allCount", allCount);


//审核流程中止
List<Long> collect = wxRentContractMapper.getRentInvalidList(wxRentContract).stream()
.map(r -> r.getId()).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(collect)) {
for (Long id:collect) {
try {
logger.info("合同id:{},开始停止...",id);
//结束审批流 by luozukai
List<Task> tasks = taskService.createTaskQuery().processDefinitionKey(WxFlowServiceImpl.getFlowKeyByType(1))
.processVariableValueEquals("businessId",id).list();
if (!CollectionUtils.isEmpty(tasks)) {
for (Task task:tasks) {
logger.info("合同id:{},taskid:{}",id,task.getId());
runtimeService.deleteProcessInstance(task.getProcessInstanceId(), "合同作废");
}
}
// 修改合同审核状态
WxRentContract rentContract = new WxRentContract();
rentContract.setId(id);
rentContract.setApplyStatus(EnumRentContractAppStatus.CANCLE.getCode());
updateApplyStatus(rentContract);

// 保存审批历史入
WxFlowRecord updateRecord = new WxFlowRecord();
updateRecord.setBusinessId(id);
updateRecord.setStatus(EnumFlowRecordStatus.CANCLE.getCode());
updateRecord.setBusinessType(1);
wxFlowRecordService.saveOrUpdate(updateRecord);
}catch (Exception e){
logger.error("deleteProcessInstance error",e);
}
}
}

//待签约 //待签约
wxRentContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); wxRentContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode());
int waitSignCount = wxRentContractMapper.queryRentContractWaitSignStatus(wxRentContract); int waitSignCount = wxRentContractMapper.queryRentContractWaitSignStatus(wxRentContract);


+ 17
- 0
mallinkService/src/main/java/com/iformall/utils/DateUtils.java Dosyayı Görüntüle

@@ -969,6 +969,23 @@ public class DateUtils {
ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH)); ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
return ca.getTime(); return ca.getTime();
} }

/**
* 获取指定月的最后一天
* @return
*/
public static Date getLastDayForMonth(String date){
try {
Calendar ca = Calendar.getInstance();
ca.setTime(new SimpleDateFormat("yyyy-MM-dd").parse(date));
ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
return ca.getTime();
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}

/** /**
* 获取指定日期n个月后的最后一天 * 获取指定日期n个月后的最后一天
* @return * @return


+ 17
- 0
mallinkService/src/main/resources/mapper/WxShopMapper.xml Dosyayı Görüntüle

@@ -499,4 +499,21 @@
and m.id=#{merchantId} and m.id=#{merchantId}
</select> </select>


<select id="getCountByWxShop" parameterType="com.iformall.domain.po.WxShop" resultType="Long">
select count(id) from wx_shop w left join wx_merchant_shop ms ON
ms.shop_id = w.id where w.tenant_id=#{tenantId} and w.is_del=0
<if test="null != startdate">
and ms.`create_date` >= #{startdate}
</if>
<if test="null != enddate">
and ms.`create_date` &lt;= #{enddate}
</if>
<if test="null != type">
and `type`=#{type}
</if>
<if test="null != status">
and status = #{status}
</if>
</select>

</mapper> </mapper>

Yükleniyor…
İptal
Kaydet