Browse Source

Merge branch 'release_toaliyun_real_202210' of https://git.malls.iformall.com/server/formallProject into release_toaliyun_real_202211

release_toaliyun_real
xhxu 3 years ago
parent
commit
49e4a944ce
7 changed files with 73 additions and 24 deletions
  1. +1
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/basic/TtPoiPlanController.java
  2. +3
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxMallMapper.java
  3. +6
    -1
      mallinkService/src/main/java/com/iformall/service/cuser/wx/WxCUserServiceAdapter.java
  4. +10
    -0
      mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java
  5. +1
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxMallServiceImpl.java
  6. +47
    -21
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java
  7. +5
    -1
      mallinkService/src/main/resources/mapper/WxMallMapper.xml

+ 1
- 1
mallinkAdmin/src/main/java/com/iformall/controller/basic/TtPoiPlanController.java View File

@@ -152,7 +152,7 @@ public class TtPoiPlanController extends BaseController {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"定向达人抖音号为空");
}
//达人去重
List<String> collect = record.getDouyinIdList().stream().collect(Collectors.toList());
List<String> collect = record.getDouyinIdList().stream().distinct().collect(Collectors.toList());
record.setDouyinIdList(collect);

if(record.getCouponId() == null){


+ 3
- 0
mallinkService/src/main/java/com/iformall/mapper/WxMallMapper.java View File

@@ -20,6 +20,7 @@ public interface WxMallMapper extends CommonMapper<WxMall, Long> {

String queryMenusByTenantInfo(WxMall wxMall);

void updateUnSubMall(@Param(value = "parentTenantId")String parentTenantId);
void undateSubmall(@Param(value = "parentTenantId")String parentTenantId, @Param(value = "tenantIds")List<String> tenantIds);

List<WxMall> listAsSelectMall(@Param(value = "id")Long id);
@@ -27,4 +28,6 @@ public interface WxMallMapper extends CommonMapper<WxMall, Long> {
List<TenantEntity> getTenantEntitys(TenantEntity tenantEntity);

List<WxMall> findListAadmin(WxMall record);


}

+ 6
- 1
mallinkService/src/main/java/com/iformall/service/cuser/wx/WxCUserServiceAdapter.java View File

@@ -127,7 +127,12 @@ public class WxCUserServiceAdapter extends BasicCUserService implements CUserSer
updateUser.setId(cuser.getId());
updateUser.updateTenantInfo(cuser);
updateUser.setUnionId(userInfo.getUnionId());
updateUser.setNickName(userInfo.getNickName());
if(userInfo.getNickName() == null){
updateUser.setNickName(AppUtils.getAppId());//获取不到微信昵称
}else{
updateUser.setNickName(userInfo.getNickName());
}

updateUser.setGender(Integer.parseInt(userInfo.getGender()));
updateUser.setAvatarUrl(userInfo.getAvatarUrl());
updateUser.setProvince(userInfo.getProvince());


+ 10
- 0
mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java View File

@@ -653,6 +653,9 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
if(oldTakeRate == null || StringUtils.isBlank(oldTakeRate.getDouyinId())){
throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR);
}
if(!EnumCpsPlanStatus.ING.getCode().equals(oldTakeRate.getStatus())){
throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该计划已取消或已完成");
}

List<String> addDouyinIdList = new ArrayList<>();
addDouyinIdList.addAll(record.getDouyinIdList());
@@ -672,6 +675,13 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
}

if(EnumCpsPlanContentType.VIDEO.getCode().equals(record.getContentType())){
//当时间改变时,
if(record.getStartTime() != null && record.getStartTime().after(oldTakeRate.getStartTime())){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"开始时间只能向前修改");
}
if(record.getEndTime() != null && record.getEndTime().before(oldTakeRate.getEndTime())){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"结束时间只能向后延长");
}
//当时间未改变时,
if(record.getStartTime() == null || record.getStartTime().equals(oldTakeRate.getStartTime())){
record.setStartTime(null);


+ 1
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxMallServiceImpl.java View File

@@ -238,6 +238,7 @@ public class WxMallServiceImpl implements WxMallService {

@Override
public void undateSubmall(String parentTenantId, List<String> tenantIds) {
wxMallMapper.updateUnSubMall(parentTenantId);
wxMallMapper.undateSubmall(parentTenantId, tenantIds);
TenantEntity tenantEntity = new TenantEntity();
tenantEntity.setTenantId(parentTenantId);


+ 47
- 21
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java View File

@@ -1389,6 +1389,18 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}


private static Date getCurrentYearRentDate(Date yearEndDate,Date rentDate){
Calendar calendar = Calendar.getInstance();
calendar.setTime(yearEndDate);
Calendar rentCalendar = Calendar.getInstance();
rentCalendar.setTime(rentDate);
calendar.set(Calendar.DAY_OF_MONTH,rentCalendar.get(Calendar.DAY_OF_MONTH));
calendar.set(Calendar.MONTH, rentCalendar.get(Calendar.MONTH));
return calendar.getTime();
}
public Map<String, Object> buildRent(int receivePeriod, long[] priceArrs, List<Date> yearList, int dayType, WxRentContract wxRentContract, Long userId, int billcount, Integer isPreview, String shopInfoStr,boolean saveDb) {
WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxRentContract);
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
@@ -1422,6 +1434,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
long needpay = 0;

boolean flag = false;
//此处逻辑处理这一年和下一年交接那一期账单。
if(yearList.size() > 1) {
if (endDate!=null && (sd.format(billTimeVo.getStartDate()).equals(sd.format(endDate)) || billTimeVo.getStartDate().after(endDate) || billTimeVo.getEndDate().after(endDate) )) {
if(yearList.size() > 1) {
@@ -1436,18 +1449,26 @@ public class WxRentContractServiceImpl implements WxRentContractService {
long needpayAfter = 0;
//同一天,算一天
if(sd.format(billTimeVo.getStartDate()).equals(sd.format(billTimeVo.getEndDate()))){
needpayFront = getNeedPayMoney(wxRentContract,priceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb,dayType,receivePeriod,false);
needpayFront = getNeedPayMoney(wxRentContract,priceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb,dayType,receivePeriod,false,false);
}else{
if(billTimeVo.getStartDate().before(endDate)){
if (EnumRentContractType.RENT_BY_JOINT.getCode().equals(wxRentContract.getType()) && EnumMissTimeType.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())) {
//设置跳点率为年周期 price不变
needpayFront = priceArrs[index - 1];
}else {
needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index - 1], billTimeVo.getStartDate(), DateUtils.getDaySet(endDate, Calendar.DATE, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true);
needpayAfter = getNeedPayMoney(wxRentContract, priceArrs[index], endDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true);
needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index - 1], billTimeVo.getStartDate(), DateUtils.getDaySet(endDate, Calendar.DATE, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,false);
needpayAfter = getNeedPayMoney(wxRentContract, priceArrs[index], endDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,false);
}
}else{
needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod,false);
//如果是按自然月,则这一年和下一年交叉部分需要重新计算
if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())) {
Date currentYearRentDate = getCurrentYearRentDate(endDate,wxRentContract.getRentalStartDate());
needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index - 1], endDate, DateUtils.getDaySet(currentYearRentDate, Calendar.DATE, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,true);
needpayAfter = getNeedPayMoney(wxRentContract, priceArrs[index], currentYearRentDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,true);
}else {
//按账单日
needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod,false,false);
}
}
}
needpay = needpayFront+needpayAfter;
@@ -1466,7 +1487,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {

//计算金额
if(!flag){
needpay = getNeedPayMoney(wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(),saveDb,dayType,receivePeriod,false);
needpay = getNeedPayMoney(wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(),saveDb,dayType,receivePeriod,false,false);
}

WxBillRent wxBillRent = new WxBillRent();
@@ -1519,13 +1540,16 @@ public class WxRentContractServiceImpl implements WxRentContractService {
return resultMap;
}

public long getNeedPayMoney(WxRentContract wxRentContract,long price,Date startDate,Date endDate,int i,int billTimeVoListSize,boolean saveDb,int dayType,int receivePeriod,boolean part){
public long getNeedPayMoney(WxRentContract wxRentContract,long price,Date startDate,Date endDate,int i,int billTimeVoListSize,boolean saveDb,int dayType,int receivePeriod,boolean part,boolean monthCalDay){
long needpay;
//按日
if (wxRentContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){
Double priceD = new Double(price);
double needpayD = WxRentContractServiceImpl.getNeedPay(0,priceD,startDate,endDate);
needpay = new Double(needpayD).longValue();
//取整
//needpay = new Double(needpayD).longValue();
//四舍五入
needpay = new BigDecimal(needpayD).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
}else{
Double priceD = new Double(price);
if (EnumRentContractType.RENT_BY_JOINT.getCode().equals(wxRentContract.getType())) {
@@ -1547,7 +1571,8 @@ public class WxRentContractServiceImpl implements WxRentContractService {

//生成金额直接计算
if(!saveDb){
needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,part)).longValue();
//needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,part)).longValue();
needpay = new BigDecimal(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,part)).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
return needpay;
}

@@ -1564,7 +1589,8 @@ public class WxRentContractServiceImpl implements WxRentContractService {
int months = getMonths(sdM.format(startDate)+"-01",sdM.format(DateUtils.getDaySet(endDate,Calendar.DATE,1))+"-01");
needpay = new Double(months * priceD).longValue();
}else{
needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue();
//needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue();
needpay = new BigDecimal(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
}
}else if(i == 0){//第一期
if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())){
@@ -1573,7 +1599,8 @@ public class WxRentContractServiceImpl implements WxRentContractService {
months++;
needpay = new Double(months * priceD).longValue();
}else{
needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue();
//needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue();
needpay = new BigDecimal(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
}
}else{
if(isFirstDay(startDate)){
@@ -1583,7 +1610,8 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
needpay = new Double(months * priceD).longValue();
}else{
needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue();
//needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue();
needpay = new BigDecimal(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
}
}
}else{//中间
@@ -1591,12 +1619,18 @@ public class WxRentContractServiceImpl implements WxRentContractService {
if(isFirstDay(startDate)){
months++;
}
needpay = new Double(months * priceD).longValue();
//如果当月费用需要按天计算
if (monthCalDay) {
//needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue();
needpay = new BigDecimal(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
}else {
needpay = new Double(months * priceD).longValue();
}
}
}
return needpay;
}

public void setExpiredDay(WxBillRent wxBillRent,int dayType, int receivePeriod){
//截止收租日在当前时间之前
Date date = new Date();
@@ -3288,12 +3322,4 @@ public class WxRentContractServiceImpl implements WxRentContractService {
return count;
}


public static void main(String[] args) {
String s = "{\"siteMoney\":\"2\",\"facilityMoney\":\"3\",\"administratorMoney\":\"4\"}";
JSONObject jsonObject = JSONObject.parseObject(s);
String siteMoney = jsonObject.getString("siteMoney");
System.out.println(siteMoney);
}

}

+ 5
- 1
mallinkService/src/main/resources/mapper/WxMallMapper.xml View File

@@ -207,9 +207,13 @@
and m.`parent_tenant_id` = #{parentTenantId}
</if>
</select>


<update id="updateUnSubMall">
update wx_mall set parent_tenant_id = null where parent_tenant_id = #{parentTenantId}
</update>
<update id="undateSubmall">
update wx_mall set parent_tenant_id = null where parent_tenant_id = #{parentTenantId} ;
<if test="tenantIds != null and tenantIds.size > 0">
update wx_mall set parent_tenant_id = #{parentTenantId} where tenant_id in
<foreach collection="tenantIds" item="item" index="index" open="("


Loading…
Cancel
Save