| @@ -13,8 +13,6 @@ import com.iformall.domain.po.WxAllBill; | |||||
| import com.iformall.domain.po.WxBillPayWay; | import com.iformall.domain.po.WxBillPayWay; | ||||
| import com.iformall.domain.po.WxEnergyFees; | import com.iformall.domain.po.WxEnergyFees; | ||||
| import com.iformall.domain.po.WxFinanceFinish; | import com.iformall.domain.po.WxFinanceFinish; | ||||
| import com.iformall.domain.po.WxFinancePrintData; | |||||
| import com.iformall.domain.po.WxFinancePrintTemplate; | |||||
| import com.iformall.domain.po.WxFinanceReceive; | import com.iformall.domain.po.WxFinanceReceive; | ||||
| import com.iformall.domain.po.WxFinanceReceiveSetoff; | import com.iformall.domain.po.WxFinanceReceiveSetoff; | ||||
| import com.iformall.domain.po.base.BaseEntity; | import com.iformall.domain.po.base.BaseEntity; | ||||
| @@ -25,7 +23,6 @@ import com.iformall.enums.EnumBillAllType; | |||||
| import com.iformall.enums.EnumFinanceCashierType; | import com.iformall.enums.EnumFinanceCashierType; | ||||
| import com.iformall.enums.EnumFinanceFinishStatus; | import com.iformall.enums.EnumFinanceFinishStatus; | ||||
| import com.iformall.enums.EnumFinanceReceiveStatus; | import com.iformall.enums.EnumFinanceReceiveStatus; | ||||
| import com.iformall.enums.EnumFinanceReceiveType; | |||||
| import com.iformall.enums.EnumYesOrNo; | import com.iformall.enums.EnumYesOrNo; | ||||
| import com.iformall.service.SysConfigService; | import com.iformall.service.SysConfigService; | ||||
| import com.iformall.service.WxEnergyService; | import com.iformall.service.WxEnergyService; | ||||
| @@ -34,12 +31,10 @@ import io.swagger.annotations.Api; | |||||
| 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 io.swagger.annotations.ApiOperation; | ||||
| import java.math.BigDecimal; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| @@ -224,20 +219,20 @@ public class WxFinanceController extends BaseController { | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @ApiOperation("预收") | |||||
| @PostMapping("saveAdvance") | |||||
| public ResultData saveAdvance(@RequestBody WxFinanceReceive record) { | |||||
| @ApiOperation("增加临时费用") | |||||
| @PostMapping("createTempFees") | |||||
| public ResultData saveAdvance(@RequestBody WxAllBill record) { | |||||
| record.updateTenantInfo(getTenantInfo()); | record.updateTenantInfo(getTenantInfo()); | ||||
| if (StringUtils.isBlank(record.getReceiveMoney())) { | |||||
| if (StringUtils.isBlank(record.getReceivePay())) { | |||||
| return new ResultData(Result.ERROR,"请填写金额"); | return new ResultData(Result.ERROR,"请填写金额"); | ||||
| } | } | ||||
| if (null == record.getFeesId()) { | |||||
| if (null == record.getEnergyFeesId()) { | |||||
| return new ResultData(Result.ERROR,"请选择科目"); | return new ResultData(Result.ERROR,"请选择科目"); | ||||
| } | } | ||||
| if (null == record.getMerchantId()) { | if (null == record.getMerchantId()) { | ||||
| return new ResultData(Result.ERROR,"请选择商户"); | return new ResultData(Result.ERROR,"请选择商户"); | ||||
| } | } | ||||
| wxFinanceService.createAdvance(record,this.getUser()); | |||||
| wxFinanceService.createTempFees(record,this.getUser()); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -252,13 +247,6 @@ public class WxFinanceController extends BaseController { | |||||
| return new ResultData(sum); | return new ResultData(sum); | ||||
| } | } | ||||
| @ApiOperation("查询冲抵列表") | |||||
| @PostMapping("setoffList") | |||||
| public ResultData setoffList(@RequestBody FinanceSetOffDTO dto) { | |||||
| dto.updateTenantInfo(getTenantInfo()); | |||||
| return new ResultData(wxFinanceService.getSetOffList(dto,true)); | |||||
| } | |||||
| @ApiOperation("计算冲抵") | @ApiOperation("计算冲抵") | ||||
| @PostMapping("calcueteSetoff") | @PostMapping("calcueteSetoff") | ||||
| public ResultData calcueteSetoff(@RequestBody FinanceSetOffDTO dto) { | public ResultData calcueteSetoff(@RequestBody FinanceSetOffDTO dto) { | ||||
| @@ -310,18 +298,6 @@ public class WxFinanceController extends BaseController { | |||||
| return new ResultData(list); | return new ResultData(list); | ||||
| } | } | ||||
| @GetMapping("receiveTypes") | |||||
| public ResultData receiveTypes() { | |||||
| List<Map> list = new ArrayList<Map>(); | |||||
| for (EnumFinanceReceiveType t : EnumFinanceReceiveType.values()) { | |||||
| Map m = new HashMap(); | |||||
| m.put("id", t.getCode()); | |||||
| m.put("name", t.getMessage()); | |||||
| list.add(m); | |||||
| } | |||||
| return new ResultData(list); | |||||
| } | |||||
| @GetMapping("cashierTypes") | @GetMapping("cashierTypes") | ||||
| public ResultData cashierTypes() { | public ResultData cashierTypes() { | ||||
| List<Map> list = new ArrayList<Map>(); | List<Map> list = new ArrayList<Map>(); | ||||
| @@ -329,6 +329,23 @@ public class WxAllBillController extends BillBaseController { | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @ApiOperation("费用科目列表") | |||||
| @GetMapping("otherFeesList") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||||
| }) | |||||
| public ResultData otherFeesList(@ModelAttribute WxEnergyFees record, Integer pageNum, Integer pageSize) { | |||||
| record.updateTenantInfo(getTenantInfo()); | |||||
| record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); | |||||
| List<Integer> typeList = new ArrayList<Integer>(); | |||||
| typeList.add(EnumBillAllType.OTHER.getCode()); | |||||
| typeList.add(EnumBillAllType.OTHER_DEPOSIT.getCode()); | |||||
| record.setBillTypeList(typeList); | |||||
| PageInfo<WxEnergyFees> page = wxEnergyService.feesListAsPage(record, pageNum, pageSize,false); | |||||
| return new ResultData(page); | |||||
| } | |||||
| /** | /** | ||||
| * 欠缴账单列表 | * 欠缴账单列表 | ||||
| @@ -167,8 +167,8 @@ public class WxBillController extends BaseController { | |||||
| return nearBillBeforeDays; | return nearBillBeforeDays; | ||||
| } | } | ||||
| @ApiOperation("分类查询账单") | |||||
| @RequestMapping("listBill") | |||||
| @ApiOperation("查询账单") | |||||
| @RequestMapping("list") | |||||
| public ResultData listBill(@ModelAttribute WxMerchant wxMerchant,Integer pageNum, Integer pageSize) { | public ResultData listBill(@ModelAttribute WxMerchant wxMerchant,Integer pageNum, Integer pageSize) { | ||||
| if (null != wxMerchant.getOnlyOweOrNear()) { | if (null != wxMerchant.getOnlyOweOrNear()) { | ||||
| if (EnumBillOweOrNearType.OWE.getCode().intValue() == wxMerchant.getOnlyOweOrNear().intValue()) { | if (EnumBillOweOrNearType.OWE.getCode().intValue() == wxMerchant.getOnlyOweOrNear().intValue()) { | ||||
| @@ -99,7 +99,7 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter { | |||||
| logger.info("newSignature={}"+newSignature); | logger.info("newSignature={}"+newSignature); | ||||
| //加密串不匹配 | //加密串不匹配 | ||||
| if (!signature.equals(newSignature)) { | if (!signature.equals(newSignature)) { | ||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"加密串校验失败"); | |||||
| throw new MallinkException(ErrorCode.THIRD_SIGN_ERROR); | |||||
| } | } | ||||
| Integer cache = RedisCacheUtils.getCacheInteger(redisTemplate, Constant.publicApiNonce+signature); | Integer cache = RedisCacheUtils.getCacheInteger(redisTemplate, Constant.publicApiNonce+signature); | ||||
| @@ -668,6 +668,8 @@ public enum ErrorCode{ | |||||
| */ | */ | ||||
| TTCOUPON_IS_EMPTY(63000, "课程不存在"), | TTCOUPON_IS_EMPTY(63000, "课程不存在"), | ||||
| TTCOUPON_IS_TAKE_OFF(63001, "课程不在上架状态"), | TTCOUPON_IS_TAKE_OFF(63001, "课程不在上架状态"), | ||||
| THIRD_SIGN_ERROR(64000, "第三方验签错误"), | |||||
| ; | ; | ||||
| @@ -112,6 +112,9 @@ public class GlobalDefultExceptionHandler { | |||||
| } else if(me.getErrorCode() == ErrorCode.SYS_REPEAT_SUBMIT_EXCEPTION.getCode()) { | } else if(me.getErrorCode() == ErrorCode.SYS_REPEAT_SUBMIT_EXCEPTION.getCode()) { | ||||
| // 重复访问不打印异常消息 | // 重复访问不打印异常消息 | ||||
| return true; | return true; | ||||
| } else if(me.getErrorCode() == ErrorCode.THIRD_SIGN_ERROR.getCode()) { | |||||
| // 重复访问不打印异常消息 | |||||
| return true; | |||||
| } | } | ||||
| } | } | ||||
| return false; | return false; | ||||
| @@ -2,7 +2,7 @@ package com.iformall.domain.dto; | |||||
| import java.util.List; | import java.util.List; | ||||
| import com.iformall.domain.po.WxFinanceReceive; | |||||
| import com.iformall.domain.po.WxAllBill; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import lombok.Data; | import lombok.Data; | ||||
| @@ -12,7 +12,7 @@ import lombok.Data; | |||||
| public class FinanceSetOffCalcuteDTO extends TenantEntity{ | public class FinanceSetOffCalcuteDTO extends TenantEntity{ | ||||
| private static final long serialVersionUID = -5605457206509995420L; | private static final long serialVersionUID = -5605457206509995420L; | ||||
| //可抵扣的预充值列表 | //可抵扣的预充值列表 | ||||
| List<WxFinanceReceive> advanceList; | |||||
| List<WxAllBill> advanceList; | |||||
| //预充值列表计数开始位置(预充值为0了会往后移) | //预充值列表计数开始位置(预充值为0了会往后移) | ||||
| Integer currentIndex; | Integer currentIndex; | ||||
| } | } | ||||
| @@ -13,5 +13,5 @@ import lombok.Data; | |||||
| public class FinanceSetOffDTO extends TenantEntity{ | public class FinanceSetOffDTO extends TenantEntity{ | ||||
| private static final long serialVersionUID = 3024690696283760441L; | private static final long serialVersionUID = 3024690696283760441L; | ||||
| private List<WxAllBill> bills; | private List<WxAllBill> bills; | ||||
| private List<Long> feesIdList; | |||||
| private Long feesId; | |||||
| } | } | ||||
| @@ -105,6 +105,20 @@ public class WxAllBill extends TenantEntity { | |||||
| @Excel(name = "冲抵金额(元)", width = 20, orderNum = "10") | @Excel(name = "冲抵金额(元)", width = 20, orderNum = "10") | ||||
| @io.swagger.annotations.ApiModelProperty(value="冲抵金额",name="setOff") | @io.swagger.annotations.ApiModelProperty(value="冲抵金额",name="setOff") | ||||
| public String setOff; | public String setOff; | ||||
| @io.swagger.annotations.ApiModelProperty(value="已使用金额(预充的使用)",name="useMoney") | |||||
| public String useMoney; | |||||
| @TableField(exist = false) | |||||
| private String remain; | |||||
| public String getRemain() { | |||||
| if (StringUtils.isBlank(pay)) { | |||||
| pay = "0"; | |||||
| } | |||||
| if (StringUtils.isBlank(useMoney)) { | |||||
| useMoney = "0"; | |||||
| } | |||||
| return new BigDecimal(pay).subtract(new BigDecimal(useMoney)).toPlainString(); | |||||
| } | |||||
| @Excel(name = "周期开始时间", format = "yyyy-MM-dd", width = 20, orderNum = "4") | @Excel(name = "周期开始时间", format = "yyyy-MM-dd", width = 20, orderNum = "4") | ||||
| @io.swagger.annotations.ApiModelProperty(value="开始时间",name="starttime") | @io.swagger.annotations.ApiModelProperty(value="开始时间",name="starttime") | ||||
| @@ -366,4 +380,6 @@ public class WxAllBill extends TenantEntity { | |||||
| private Integer needPayNoDays; | private Integer needPayNoDays; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| public List<Long> energyFeesIds; | public List<Long> energyFeesIds; | ||||
| @TableField(exist = false) | |||||
| public Integer advanceHasMoney; | |||||
| } | } | ||||
| @@ -7,7 +7,6 @@ import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.enums.EnumFinanceCashierType; | import com.iformall.enums.EnumFinanceCashierType; | ||||
| import com.iformall.enums.EnumFinanceFinishStatus; | import com.iformall.enums.EnumFinanceFinishStatus; | ||||
| import com.iformall.enums.EnumFinanceReceiveStatus; | import com.iformall.enums.EnumFinanceReceiveStatus; | ||||
| import com.iformall.enums.EnumFinanceReceiveType; | |||||
| import lombok.Data; | import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
| @@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.enums.EnumFinanceCashierType; | import com.iformall.enums.EnumFinanceCashierType; | ||||
| import com.iformall.enums.EnumFinanceReceiveStatus; | import com.iformall.enums.EnumFinanceReceiveStatus; | ||||
| import com.iformall.enums.EnumFinanceReceiveType; | |||||
| import com.iformall.utils.PriceUtilV2; | import com.iformall.utils.PriceUtilV2; | ||||
| import lombok.Data; | import lombok.Data; | ||||
| @@ -81,19 +80,6 @@ public class WxFinanceReceive extends TenantEntity { | |||||
| return setOffMoneyChinese; | return setOffMoneyChinese; | ||||
| } | } | ||||
| @io.swagger.annotations.ApiModelProperty(value = "已使用金额,冲抵里面使用", name = "useMoney") | |||||
| private String useMoney; | |||||
| public String getRemain() { | |||||
| if (StringUtils.isBlank(useMoney)) { | |||||
| useMoney = "0"; | |||||
| } | |||||
| if (StringUtils.isBlank(receiveMoney)) { | |||||
| receiveMoney = "0"; | |||||
| } | |||||
| return new BigDecimal(receiveMoney).subtract(new BigDecimal(useMoney)).toPlainString(); | |||||
| } | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private String allReceiveMoney; | private String allReceiveMoney; | ||||
| public String getAllReceiveMoney() { | public String getAllReceiveMoney() { | ||||
| @@ -138,17 +124,6 @@ public class WxFinanceReceive extends TenantEntity { | |||||
| return null; | return null; | ||||
| } | } | ||||
| @io.swagger.annotations.ApiModelProperty(value = "类型EnumFinanceReceiveType", name = "type") | |||||
| private Integer receiveType; | |||||
| @TableField(exist = false) | |||||
| private String receiveTypeName; | |||||
| public String getReceiveTypeName() { | |||||
| if (null != receiveType) { | |||||
| return EnumFinanceReceiveType.getEnum(receiveType).getMessage(); | |||||
| } | |||||
| return null; | |||||
| } | |||||
| @io.swagger.annotations.ApiModelProperty(value="createBy",name="createBy") | @io.swagger.annotations.ApiModelProperty(value="createBy",name="createBy") | ||||
| private Long createBy; | private Long createBy; | ||||
| @io.swagger.annotations.ApiModelProperty(value="createByName",name="createByName") | @io.swagger.annotations.ApiModelProperty(value="createByName",name="createByName") | ||||
| @@ -195,7 +170,5 @@ public class WxFinanceReceive extends TenantEntity { | |||||
| private Integer finishStatus; | private Integer finishStatus; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private Long finishId; | private Long finishId; | ||||
| @TableField(exist = false) | |||||
| private Integer hasExtraMoney; | |||||
| } | } | ||||
| @@ -0,0 +1,14 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import lombok.Data; | |||||
| /** | |||||
| */ | |||||
| @Data | |||||
| public class FinanceAdvanceBillVo extends TenantEntity{ | |||||
| private static final long serialVersionUID = 7782990283380920310L; | |||||
| private Long feesId; | |||||
| private String feesName; | |||||
| private String remain; | |||||
| } | |||||
| @@ -1,6 +1,5 @@ | |||||
| package com.iformall.domain.vo; | package com.iformall.domain.vo; | ||||
| import com.iformall.domain.po.WxFinanceReceive; | |||||
| import lombok.Data; | import lombok.Data; | ||||
| import java.io.Serializable; | import java.io.Serializable; | ||||
| import java.math.BigDecimal; | import java.math.BigDecimal; | ||||
| @@ -12,5 +11,5 @@ public class FinanceBillSetoffSum implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | private static final long serialVersionUID = 1L; | ||||
| private BigDecimal total; | private BigDecimal total; | ||||
| private List<WxFinanceReceive> advanceList; //feesId,totalMoney,userMoney | |||||
| private List<FinanceAdvanceBillVo> advanceList; //feesId,feesName,remain | |||||
| } | } | ||||
| @@ -10,7 +10,6 @@ import com.iformall.domain.po.WxFinanceReceive; | |||||
| import com.iformall.domain.po.WxFinanceReceiveBill; | import com.iformall.domain.po.WxFinanceReceiveBill; | ||||
| import com.iformall.enums.EnumBillAllType; | import com.iformall.enums.EnumBillAllType; | ||||
| import com.iformall.enums.EnumFinanceReceiveStatus; | import com.iformall.enums.EnumFinanceReceiveStatus; | ||||
| import com.iformall.enums.EnumFinanceReceiveType; | |||||
| import lombok.Data; | import lombok.Data; | ||||
| @@ -40,9 +39,6 @@ public class WxFinanceReceiveVo implements Serializable { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "冲抵金额", name = "setOffMoney") | @io.swagger.annotations.ApiModelProperty(value = "冲抵金额", name = "setOffMoney") | ||||
| private String setOffMoney; | private String setOffMoney; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "已使用金额,冲抵里面使用", name = "useMoney") | |||||
| private String useMoney; | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private String totalMoney; | private String totalMoney; | ||||
| public String getTotalMoney() { | public String getTotalMoney() { | ||||
| @@ -66,17 +62,6 @@ public class WxFinanceReceiveVo implements Serializable { | |||||
| return null; | return null; | ||||
| } | } | ||||
| @io.swagger.annotations.ApiModelProperty(value = "类型EnumFinanceReceiveType", name = "type") | |||||
| private Integer type; | |||||
| @TableField(exist = false) | |||||
| private String typeName; | |||||
| public String getTypeName() { | |||||
| if (null != type) { | |||||
| return EnumFinanceReceiveType.getEnum(type).getMessage(); | |||||
| } | |||||
| return null; | |||||
| } | |||||
| @io.swagger.annotations.ApiModelProperty(value="createBy",name="createBy") | @io.swagger.annotations.ApiModelProperty(value="createBy",name="createBy") | ||||
| private Long createBy; | private Long createBy; | ||||
| @io.swagger.annotations.ApiModelProperty(value="createByName",name="createByName") | @io.swagger.annotations.ApiModelProperty(value="createByName",name="createByName") | ||||
| @@ -159,9 +144,7 @@ public class WxFinanceReceiveVo implements Serializable { | |||||
| this.updateTime = receive.getUpdateTime(); | this.updateTime = receive.getUpdateTime(); | ||||
| this.receiveMoney = receive.getReceiveMoney(); | this.receiveMoney = receive.getReceiveMoney(); | ||||
| this.setOffMoney = receive.getSetOffMoney(); | this.setOffMoney = receive.getSetOffMoney(); | ||||
| this.useMoney = receive.getUseMoney(); | |||||
| this.status = receive.getStatus(); | this.status = receive.getStatus(); | ||||
| this.type = receive.getType(); | |||||
| this.createBy = receive.getCreateBy(); | this.createBy = receive.getCreateBy(); | ||||
| this.createByName = receive.getCreateByName(); | this.createByName = receive.getCreateByName(); | ||||
| this.updateBy = receive.getUpdateBy(); | this.updateBy = receive.getUpdateBy(); | ||||
| @@ -1,37 +0,0 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| */ | |||||
| public enum EnumFinanceReceiveType { | |||||
| RECEIVE(1,"缴费收单"), | |||||
| ADVANCE(2,"预充收单") | |||||
| ; | |||||
| public static EnumFinanceReceiveType getEnum(Integer code) { | |||||
| for (EnumFinanceReceiveType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumFinanceReceiveType(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -17,6 +17,8 @@ public interface WxAllBillMapper extends CommonMapper<WxAllBill, Long> { | |||||
| List<WxAllBill> findList(WxAllBill wxBillRent); | List<WxAllBill> findList(WxAllBill wxBillRent); | ||||
| List<Long> queryBillRentContractIdList(WxAllBill record); | List<Long> queryBillRentContractIdList(WxAllBill record); | ||||
| List<WxAllBill> getMerchantAdvanceGroupSumList(WxAllBill wxBillRent); | |||||
| List<WxBillNotify> getBillNotifyList(WxAllBill record); | List<WxBillNotify> getBillNotifyList(WxAllBill record); | ||||
| void deleteBillByContract(WxRentContract wxRentContract); | void deleteBillByContract(WxRentContract wxRentContract); | ||||
| @@ -14,5 +14,7 @@ public interface WxEnergyFeesMapper extends CommonMapper<WxEnergyFees, Long> { | |||||
| WxEnergyFees selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | WxEnergyFees selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | ||||
| void setIsDel(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("isDel")Integer isDel); | void setIsDel(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("isDel")Integer isDel); | ||||
| List<Long> findIdList(WxEnergyFees wxBillRent); | |||||
| } | } | ||||
| @@ -20,8 +20,6 @@ public interface WxFinanceReceiveMapper extends CommonMapper<WxFinanceReceive, L | |||||
| void setIsDel(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("isDel")Integer isDel); | void setIsDel(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("isDel")Integer isDel); | ||||
| List<WxFinanceReceive> getMerchantAdvanceGroupSumList(WxFinanceReceive record); | |||||
| void finish(WxFinanceReceive wxBillRent); | void finish(WxFinanceReceive wxBillRent); | ||||
| WxFinanceReceiveSumVo getReceiveSum(WxFinanceReceive record); | WxFinanceReceiveSumVo getReceiveSum(WxFinanceReceive record); | ||||
| @@ -36,6 +36,8 @@ public class PrintBillDataHandler implements PrintDataParser{ | |||||
| return receive.getSetOff(); | return receive.getSetOff(); | ||||
| }else if (name.equals("returnPay")) { | }else if (name.equals("returnPay")) { | ||||
| return receive.getReturnPay(); | return receive.getReturnPay(); | ||||
| }else if (name.equals("useMoney")) { | |||||
| return receive.getUseMoney(); | |||||
| }else if (name.equals("starttime")) { | }else if (name.equals("starttime")) { | ||||
| if (null != receive.getStarttime()) { | if (null != receive.getStarttime()) { | ||||
| return DateUtils.date2String(receive.getStarttime(),DateUtils.DATE_PATTERN); | return DateUtils.date2String(receive.getStarttime(),DateUtils.DATE_PATTERN); | ||||
| @@ -52,10 +52,6 @@ public class PrintFinanceReceiveDataHandler implements PrintDataParser{ | |||||
| return receive.getAllReceiveMoney(); | return receive.getAllReceiveMoney(); | ||||
| }else if (name.equals("allReceiveMoneyChinese")) { | }else if (name.equals("allReceiveMoneyChinese")) { | ||||
| return receive.getAllReceiveMoneyChinese(); | return receive.getAllReceiveMoneyChinese(); | ||||
| }else if (name.equals("useMoney")) { | |||||
| return receive.getUseMoney(); | |||||
| }else if (name.equals("receiveTypeName")) { | |||||
| return receive.getReceiveTypeName(); | |||||
| }else if (name.equals("createByName")) { | }else if (name.equals("createByName")) { | ||||
| return receive.getCreateByName(); | return receive.getCreateByName(); | ||||
| }else if (name.equals("moneyDetail")) { | }else if (name.equals("moneyDetail")) { | ||||
| @@ -53,6 +53,8 @@ public interface WxAllBillService { | |||||
| void completeBill(EnumBillStatus status,WxMerchant wxMerchant,MallUserInfo user); | void completeBill(EnumBillStatus status,WxMerchant wxMerchant,MallUserInfo user); | ||||
| List<WxAllBill> getMerchantAdvanceGroupSumList(WxAllBill wxBillRent); | |||||
| List<WxAllBill> list(WxAllBill record); | List<WxAllBill> list(WxAllBill record); | ||||
| List<WxBillNotify> notifyList(WxAllBill record); | List<WxBillNotify> notifyList(WxAllBill record); | ||||
| @@ -12,6 +12,7 @@ import org.springframework.web.multipart.MultipartFile; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.po.MallUserInfo; | import com.iformall.domain.po.MallUserInfo; | ||||
| import com.iformall.domain.po.WxEnergyFees; | import com.iformall.domain.po.WxEnergyFees; | ||||
| import com.iformall.domain.po.WxEnergyFeesSetoff; | |||||
| import com.iformall.domain.po.WxEnergyFeesTime; | import com.iformall.domain.po.WxEnergyFeesTime; | ||||
| import com.iformall.domain.po.WxEnergyMeter; | import com.iformall.domain.po.WxEnergyMeter; | ||||
| import com.iformall.domain.po.WxEnergyMeterReading; | import com.iformall.domain.po.WxEnergyMeterReading; | ||||
| @@ -44,6 +45,9 @@ public interface WxEnergyService { | |||||
| void setFeesIsDel(WxEnergyFees record); | void setFeesIsDel(WxEnergyFees record); | ||||
| Map<Long,WxEnergyFees> getFeesMap(WxEnergyFees record); | Map<Long,WxEnergyFees> getFeesMap(WxEnergyFees record); | ||||
| void initEnergyFees(TenantEntity tenantEntity); | void initEnergyFees(TenantEntity tenantEntity); | ||||
| List<Long> getAdvanceSetoffFeesids(WxEnergyFeesSetoff setoff); | |||||
| List<Long> getFeesIdList(WxEnergyFees record); | |||||
| //抄表数据 | //抄表数据 | ||||
| PageInfo<WxEnergyMeterReading> readingListAsPage(WxEnergyMeterReading record, Integer pageIndex, Integer pageSize); | PageInfo<WxEnergyMeterReading> readingListAsPage(WxEnergyMeterReading record, Integer pageIndex, Integer pageSize); | ||||
| @@ -2,6 +2,9 @@ package com.iformall.service; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| import org.springframework.web.bind.annotation.RequestBody; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.dto.FinanceSetOffDTO; | import com.iformall.domain.dto.FinanceSetOffDTO; | ||||
| import com.iformall.domain.po.MallUserInfo; | import com.iformall.domain.po.MallUserInfo; | ||||
| @@ -41,10 +44,12 @@ public interface WxFinanceService { | |||||
| //预收款 | //预收款 | ||||
| List<WxAllBill> calcuetSetOff(FinanceSetOffDTO dto,MallUserInfo user); | List<WxAllBill> calcuetSetOff(FinanceSetOffDTO dto,MallUserInfo user); | ||||
| FinanceBillSetoffSum getBillSetoffSum(WxFinanceReceive record); | FinanceBillSetoffSum getBillSetoffSum(WxFinanceReceive record); | ||||
| List<WxFinanceReceive> getSetOffList(FinanceSetOffDTO dto,boolean isMerge); | |||||
| void createAdvance(WxFinanceReceive record,MallUserInfo user); | |||||
| //List<WxFinanceReceive> getSetOffList(FinanceSetOffDTO dto,boolean isMerge); | |||||
| PageInfo<WxFinanceReceiveSetoff> receiveSetoffListAsPage(WxFinanceReceive record, Integer pageIndex, Integer pageSize); | PageInfo<WxFinanceReceiveSetoff> receiveSetoffListAsPage(WxFinanceReceive record, Integer pageIndex, Integer pageSize); | ||||
| //增加临时费用 | |||||
| void createTempFees(WxAllBill record,MallUserInfo user); | |||||
| //结账 | //结账 | ||||
| PageInfo<WxFinanceFinish> finishListAsPage(WxFinanceFinish record, Integer pageIndex, Integer pageSize); | PageInfo<WxFinanceFinish> finishListAsPage(WxFinanceFinish record, Integer pageIndex, Integer pageSize); | ||||
| WxFinanceFinish getFinishById(TenantEntity tenantEntity,Long id); | WxFinanceFinish getFinishById(TenantEntity tenantEntity,Long id); | ||||
| @@ -342,6 +342,10 @@ public class WxBillAllHelper { | |||||
| wxAllBillService.completeBill(status,wxMerchant, user); | wxAllBillService.completeBill(status,wxMerchant, user); | ||||
| } | } | ||||
| public List<WxAllBill> getMerchantAdvanceGroupSumList(WxAllBill bill) { | |||||
| return wxAllBillService.getMerchantAdvanceGroupSumList(bill); | |||||
| } | |||||
| /** | /** | ||||
| * 退租: | * 退租: | ||||
| * 账单开始时间>= 今天,并且账单是 WAIT_PAY,NOT_PAID,NOT_EXPIRED,BAD 变为INVALID,如果已付了款,需要退回 | * 账单开始时间>= 今天,并且账单是 WAIT_PAY,NOT_PAID,NOT_EXPIRED,BAD 变为INVALID,如果已付了款,需要退回 | ||||
| @@ -490,6 +490,12 @@ public class WxAllBillServiceImpl extends WxBillBaseService implements WxAllBill | |||||
| } | } | ||||
| @Override | |||||
| public List<WxAllBill> getMerchantAdvanceGroupSumList(WxAllBill record) { | |||||
| updateQueryParam(record); | |||||
| return wxAllBillMapper.getMerchantAdvanceGroupSumList(record); | |||||
| } | |||||
| @Override | @Override | ||||
| public List<WxAllBill> list(WxAllBill record) { | public List<WxAllBill> list(WxAllBill record) { | ||||
| updateQueryParam(record); | updateQueryParam(record); | ||||
| @@ -679,11 +685,12 @@ public class WxAllBillServiceImpl extends WxBillBaseService implements WxAllBill | |||||
| record.setId(idWorker.nextId()); | record.setId(idWorker.nextId()); | ||||
| record.setCreatetime(date); | record.setCreatetime(date); | ||||
| record.setUpdatetime(date); | record.setUpdatetime(date); | ||||
| record.setUpdateBy(user.getId()); | |||||
| record.setUpdateByName(user.getName()); | |||||
| record.setCreateBy(user.getId()); | |||||
| record.setCreateByName(user.getName()); | |||||
| record.updateTenantInfo(user); | |||||
| if (null != user) { | |||||
| record.setUpdateBy(user.getId()); | |||||
| record.setUpdateByName(user.getName()); | |||||
| record.setCreateBy(user.getId()); | |||||
| record.setCreateByName(user.getName()); | |||||
| } | |||||
| try { | try { | ||||
| wxAllBillMapper.insert(record); | wxAllBillMapper.insert(record); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| @@ -693,8 +700,10 @@ public class WxAllBillServiceImpl extends WxBillBaseService implements WxAllBill | |||||
| return new ResultData(Result.SUCCESS, "保存账单成功"); | return new ResultData(Result.SUCCESS, "保存账单成功"); | ||||
| } else { | } else { | ||||
| record.setUpdatetime(date); | record.setUpdatetime(date); | ||||
| record.setUpdateBy(user.getId()); | |||||
| record.setUpdateByName(user.getName()); | |||||
| if (null != user) { | |||||
| record.setUpdateBy(user.getId()); | |||||
| record.setUpdateByName(user.getName()); | |||||
| } | |||||
| wxAllBillMapper.updateById(record); | wxAllBillMapper.updateById(record); | ||||
| return new ResultData(Result.SUCCESS, "保存账单成功"); | return new ResultData(Result.SUCCESS, "保存账单成功"); | ||||
| } | } | ||||
| @@ -391,8 +391,17 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||||
| wxEnergyFeesMapper.insert(fees); | wxEnergyFeesMapper.insert(fees); | ||||
| } | } | ||||
| } | } | ||||
| @Override | |||||
| public List<Long> getAdvanceSetoffFeesids(WxEnergyFeesSetoff setoff) { | |||||
| return wxEnergyFeesSetoffMapper.findFeesIdList(setoff); | |||||
| } | |||||
| @Override | |||||
| public List<Long> getFeesIdList(WxEnergyFees record) { | |||||
| return wxEnergyFeesMapper.findIdList(record); | |||||
| } | |||||
| @Override | @Override | ||||
| public PageInfo<WxEnergyMeterReading> readingListAsPage(WxEnergyMeterReading record, Integer pageIndex, | public PageInfo<WxEnergyMeterReading> readingListAsPage(WxEnergyMeterReading record, Integer pageIndex, | ||||
| Integer pageSize) { | Integer pageSize) { | ||||
| @@ -26,6 +26,7 @@ import com.iformall.domain.po.WxMerchant; | |||||
| import com.iformall.domain.po.WxShop; | import com.iformall.domain.po.WxShop; | ||||
| import com.iformall.domain.po.base.BaseEntity.SortField; | import com.iformall.domain.po.base.BaseEntity.SortField; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.FinanceAdvanceBillVo; | |||||
| import com.iformall.domain.vo.FinanceBillSetoffSum; | import com.iformall.domain.vo.FinanceBillSetoffSum; | ||||
| import com.iformall.domain.vo.FinanceSetOffDetailVo; | import com.iformall.domain.vo.FinanceSetOffDetailVo; | ||||
| import com.iformall.domain.vo.WxFinanceReceiveSumVo; | import com.iformall.domain.vo.WxFinanceReceiveSumVo; | ||||
| @@ -35,7 +36,6 @@ import com.iformall.enums.EnumBillStatus; | |||||
| import com.iformall.enums.EnumFinanceCashierType; | import com.iformall.enums.EnumFinanceCashierType; | ||||
| import com.iformall.enums.EnumFinanceFinishStatus; | import com.iformall.enums.EnumFinanceFinishStatus; | ||||
| import com.iformall.enums.EnumFinanceReceiveStatus; | import com.iformall.enums.EnumFinanceReceiveStatus; | ||||
| import com.iformall.enums.EnumFinanceReceiveType; | |||||
| import com.iformall.enums.EnumYesOrNo; | import com.iformall.enums.EnumYesOrNo; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.WxBillPayWayMapper; | import com.iformall.mapper.WxBillPayWayMapper; | ||||
| @@ -47,6 +47,7 @@ import com.iformall.mapper.WxFinanceReceiveBillMapper; | |||||
| import com.iformall.mapper.WxFinanceReceiveMapper; | import com.iformall.mapper.WxFinanceReceiveMapper; | ||||
| import com.iformall.mapper.WxFinanceReceivePaywayMapper; | import com.iformall.mapper.WxFinanceReceivePaywayMapper; | ||||
| import com.iformall.mapper.WxFinanceReceiveSetoffMapper; | import com.iformall.mapper.WxFinanceReceiveSetoffMapper; | ||||
| import com.iformall.service.WxAllBillService; | |||||
| import com.iformall.service.WxEnergyService; | import com.iformall.service.WxEnergyService; | ||||
| import com.iformall.service.WxFinanceService; | import com.iformall.service.WxFinanceService; | ||||
| import com.iformall.service.WxMerchantService; | import com.iformall.service.WxMerchantService; | ||||
| @@ -54,7 +55,6 @@ import com.iformall.service.WxShopService; | |||||
| import com.iformall.service.helper.WxBillAllHelper; | import com.iformall.service.helper.WxBillAllHelper; | ||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| 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; | ||||
| @@ -106,9 +106,13 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| @Lazy | @Lazy | ||||
| @Autowired | @Autowired | ||||
| WxShopService wxShopService; | WxShopService wxShopService; | ||||
| @Lazy | |||||
| @Autowired | |||||
| WxBillAllHelper wxBillAllHelper; | |||||
| @Lazy | @Lazy | ||||
| @Autowired | @Autowired | ||||
| WxBillAllHelper wxBillAllHelper; | |||||
| WxAllBillService wxAllBillService; | |||||
| @@ -198,76 +202,41 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| @Override | @Override | ||||
| public FinanceBillSetoffSum getBillSetoffSum(WxFinanceReceive record) { | public FinanceBillSetoffSum getBillSetoffSum(WxFinanceReceive record) { | ||||
| record.setType(EnumFinanceCashierType.RECEIVE.getCode()); | |||||
| record.setReceiveType(EnumFinanceReceiveType.ADVANCE.getCode()); | |||||
| record.setStatus(EnumFinanceReceiveStatus.NORMAL.getCode()); | |||||
| List<WxFinanceReceive> advanceList = wxFinanceReceiveMapper.getMerchantAdvanceGroupSumList(record); | |||||
| //取账单里面的 | |||||
| //查询预存账单 | |||||
| WxAllBill abq = new WxAllBill(); | |||||
| abq.updateTenantInfo(record); | |||||
| abq.setBillType(EnumBillAllType.ADVANCE.getCode()); | |||||
| abq.setMerchantId(record.getMerchantId()); | |||||
| abq.setAdvanceHasMoney(EnumYesOrNo.YES.getCode()); | |||||
| List<WxAllBill> advanceList = wxBillAllHelper.getMerchantAdvanceGroupSumList(abq); | |||||
| BigDecimal total = new BigDecimal(0); | BigDecimal total = new BigDecimal(0); | ||||
| FinanceBillSetoffSum retMap = new FinanceBillSetoffSum(); | FinanceBillSetoffSum retMap = new FinanceBillSetoffSum(); | ||||
| List<FinanceAdvanceBillVo> bvolist = new ArrayList<FinanceAdvanceBillVo>(); | |||||
| if (null != advanceList && advanceList.size() > 0 ) { | if (null != advanceList && advanceList.size() > 0 ) { | ||||
| WxEnergyFees fat = new WxEnergyFees(); | WxEnergyFees fat = new WxEnergyFees(); | ||||
| fat.updateTenantInfo(record); | fat.updateTenantInfo(record); | ||||
| Map<Long, WxEnergyFees> advanceTypMap = wxEnergyService.getFeesMap(fat); | Map<Long, WxEnergyFees> advanceTypMap = wxEnergyService.getFeesMap(fat); | ||||
| for (int i = 0 ; i < advanceList.size() ; i++) { | for (int i = 0 ; i < advanceList.size() ; i++) { | ||||
| WxFinanceReceive at = advanceList.get(i); | |||||
| if (null != at.getFeesId() && null != advanceTypMap) { | |||||
| WxEnergyFees wfat = advanceTypMap.get(at.getFeesId()); | |||||
| WxAllBill at = advanceList.get(i); | |||||
| FinanceAdvanceBillVo vo = new FinanceAdvanceBillVo(); | |||||
| vo.setFeesId(at.getEnergyFeesId()); | |||||
| vo.setRemain(at.getRemain()); | |||||
| if (null != at.getEnergyFeesId() && null != advanceTypMap) { | |||||
| WxEnergyFees wfat = advanceTypMap.get(at.getEnergyFeesId()); | |||||
| if (null != wfat) { | if (null != wfat) { | ||||
| at.setFeesName(wfat.getName()); | |||||
| vo.setFeesName(wfat.getName()); | |||||
| } | } | ||||
| total = total.add(new BigDecimal(at.getRemain())); | |||||
| } | } | ||||
| total = total.add(new BigDecimal(at.getRemain())); | |||||
| bvolist.add(vo); | |||||
| } | } | ||||
| } | } | ||||
| retMap.setTotal(total); | retMap.setTotal(total); | ||||
| retMap.setAdvanceList(advanceList); | |||||
| retMap.setAdvanceList(bvolist); | |||||
| return retMap; | return retMap; | ||||
| } | } | ||||
| @Override | |||||
| public List<WxFinanceReceive> getSetOffList(FinanceSetOffDTO dto,boolean isMerge) { | |||||
| if (null == dto.getBills() || dto.getBills().size() <= 0 ) { | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"请选择账单"); | |||||
| } | |||||
| Long billFeesId = null; | |||||
| for (int i = 0 ; i < dto.getBills().size(); i++) { | |||||
| WxAllBill b = dto.getBills().get(i); | |||||
| if (null == billFeesId) { | |||||
| billFeesId = b.getEnergyFeesId(); | |||||
| }else if (billFeesId.equals(b.getEnergyFeesId())) { | |||||
| }else if (!billFeesId.equals(b.getEnergyFeesId())) { | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"请选择相同科目"); | |||||
| } | |||||
| } | |||||
| //通过账单科目去查询可以抵扣的预充费用 | |||||
| WxEnergyFeesSetoff tf = new WxEnergyFeesSetoff(); | |||||
| tf.updateTenantInfo(dto); | |||||
| tf.setFeesId(billFeesId); | |||||
| List<Long> feesIdList = wxEnergyFeesSetoffMapper.findadvanceFeesIdList(tf); | |||||
| if (null != feesIdList && feesIdList.size() > 0 ) { | |||||
| WxFinanceReceive faq = new WxFinanceReceive(); | |||||
| faq.updateTenantInfo(dto); | |||||
| faq.setFeesIdList(feesIdList); | |||||
| if (isMerge) { | |||||
| FinanceBillSetoffSum sum = getBillSetoffSum(faq); | |||||
| if (null == sum) { | |||||
| return null; | |||||
| } | |||||
| return sum.getAdvanceList(); | |||||
| }else { | |||||
| faq.setType(EnumFinanceCashierType.RECEIVE.getCode()); | |||||
| faq.setReceiveType(EnumFinanceReceiveType.ADVANCE.getCode()); | |||||
| faq.setStatus(EnumFinanceReceiveStatus.NORMAL.getCode()); | |||||
| faq.setSortColumns(SortField.CreateTime_ASC); | |||||
| faq.setHasExtraMoney(EnumYesOrNo.YES.getCode()); | |||||
| return wxFinanceReceiveMapper.findList(faq); | |||||
| } | |||||
| }else { | |||||
| return null; | |||||
| } | |||||
| } | |||||
| //根据预充值收款单来冲抵账单 | //根据预充值收款单来冲抵账单 | ||||
| private void setSetOff(WxAllBill bill,FinanceSetOffCalcuteDTO calcuteDto) { | private void setSetOff(WxAllBill bill,FinanceSetOffCalcuteDTO calcuteDto) { | ||||
| BigDecimal owe = new BigDecimal(bill.getOwe()); | BigDecimal owe = new BigDecimal(bill.getOwe()); | ||||
| @@ -281,7 +250,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| if (owe.compareTo(b0) <= 0) { | if (owe.compareTo(b0) <= 0) { | ||||
| break; | break; | ||||
| } | } | ||||
| WxFinanceReceive advance = calcuteDto.getAdvanceList().get(j); | |||||
| WxAllBill advance = calcuteDto.getAdvanceList().get(j); | |||||
| BigDecimal remain = new BigDecimal(advance.getRemain()); | BigDecimal remain = new BigDecimal(advance.getRemain()); | ||||
| if (remain.compareTo(b0) > 0) { | if (remain.compareTo(b0) > 0) { | ||||
| if (null == setoffList) { | if (null == setoffList) { | ||||
| @@ -306,7 +275,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| //设置账单本次抵扣 | //设置账单本次抵扣 | ||||
| bill.setCurrentSetOff(billCurrentSetOff.add(remain).toPlainString()); | bill.setCurrentSetOff(billCurrentSetOff.add(remain).toPlainString()); | ||||
| //设置预充已使用金额 | //设置预充已使用金额 | ||||
| advance.setUseMoney(advance.getReceiveMoney()); | |||||
| advance.setUseMoney(advance.getPay()); | |||||
| dv.setSetoff(remain.toPlainString()); | dv.setSetoff(remain.toPlainString()); | ||||
| setoffList.add(dv); | setoffList.add(dv); | ||||
| bill.setSetOffDetailList(setoffList); | bill.setSetOffDetailList(setoffList); | ||||
| @@ -332,11 +301,26 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| public List<WxAllBill> calcuetSetOff(FinanceSetOffDTO dto,MallUserInfo user) { | public List<WxAllBill> calcuetSetOff(FinanceSetOffDTO dto,MallUserInfo user) { | ||||
| //多个账单类型和科目必须一致 | //多个账单类型和科目必须一致 | ||||
| //优先冲抵时间早的账单,优先用时间早的预充费用来冲抵 | //优先冲抵时间早的账单,优先用时间早的预充费用来冲抵 | ||||
| if (null == dto.getBills() || dto.getBills().size() <= 0 || null == dto.getFeesIdList() || dto.getFeesIdList().size() <= 0 ) { | |||||
| if (null == dto.getBills() || dto.getBills().size() <= 0 || null == dto.getFeesId()) { | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"请选择账单和抵扣科目"); | throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"请选择账单和抵扣科目"); | ||||
| } | } | ||||
| //查询预收科目可冲抵的科目 | |||||
| WxEnergyFeesSetoff fsq = new WxEnergyFeesSetoff(); | |||||
| fsq.updateTenantInfo(dto); | |||||
| fsq.setAdvanceFeesId(dto.getFeesId()); | |||||
| List<Long> setOffFeesIds = wxEnergyService.getAdvanceSetoffFeesids(fsq); | |||||
| if (null == setOffFeesIds || setOffFeesIds.size() <= 0 ) { | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"该科目未设置可冲抵科目"); | |||||
| } | |||||
| //查询出账单可以抵扣的科目预收项 | //查询出账单可以抵扣的科目预收项 | ||||
| List<WxFinanceReceive> advanceList = getSetOffList(dto,false); | |||||
| WxAllBill abq = new WxAllBill(); | |||||
| abq.updateTenantInfo(dto); | |||||
| abq.setEnergyFeesIds(setOffFeesIds); | |||||
| abq.setBillType(EnumBillAllType.ADVANCE.getCode()); | |||||
| abq.setAdvanceHasMoney(EnumYesOrNo.YES.getCode()); | |||||
| abq.setSortColumns(SortField.Createtime_ASC); | |||||
| List<WxAllBill> advanceList = wxAllBillService.list(abq); | |||||
| if (null == advanceList || advanceList.size() <= 0 ) { | if (null == advanceList || advanceList.size() <= 0 ) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| @@ -356,16 +340,19 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| be.setCurrentReceive(null); | be.setCurrentReceive(null); | ||||
| be.setCurrentSetOff(null); | be.setCurrentSetOff(null); | ||||
| WxAllBill bill = wxBillAllHelper.getBillDetail(EnumBillAllType.getEnum(be.getBillType()), merchant, be.getId()); | WxAllBill bill = wxBillAllHelper.getBillDetail(EnumBillAllType.getEnum(be.getBillType()), merchant, be.getId()); | ||||
| be.setReceivePay(bill.getReceivePay()); | |||||
| be.setPay(bill.getPay()); | |||||
| be.setSetOff(bill.getSetOff()); | |||||
| setSetOff(be, calcuteDto); | |||||
| WxAllBill retb = new WxAllBill(); | |||||
| retb.setId(be.getId()); | |||||
| retb.setSetOffDetailList(be.getSetOffDetailList()); | |||||
| retb.setCurrentSetOff(be.getCurrentSetOff()); | |||||
| retb.setCurrentReceive(be.getCurrentReceive()); | |||||
| retList.add(retb); | |||||
| //如果账单的科目不在冲抵的范围内,则不冲抵 | |||||
| if (setOffFeesIds.contains(bill.getEnergyFeesId())) { | |||||
| be.setReceivePay(bill.getReceivePay()); | |||||
| be.setPay(bill.getPay()); | |||||
| be.setSetOff(bill.getSetOff()); | |||||
| setSetOff(be, calcuteDto); | |||||
| WxAllBill retb = new WxAllBill(); | |||||
| retb.setId(be.getId()); | |||||
| retb.setSetOffDetailList(be.getSetOffDetailList()); | |||||
| retb.setCurrentSetOff(be.getCurrentSetOff()); | |||||
| retb.setCurrentReceive(be.getCurrentReceive()); | |||||
| retList.add(retb); | |||||
| } | |||||
| } | } | ||||
| return retList; | return retList; | ||||
| } | } | ||||
| @@ -587,7 +574,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| sortBills(bills); | sortBills(bills); | ||||
| //创建主收款单 | //创建主收款单 | ||||
| WxFinanceReceive addreceive = generateReceive(receiveId,user, EnumFinanceCashierType.RECEIVE,EnumFinanceReceiveType.RECEIVE, receiveTotal.toPlainString(),null, record.getMerchantId(), null, record.getRemark()); | |||||
| WxFinanceReceive addreceive = generateReceive(receiveId,user, EnumFinanceCashierType.RECEIVE,receiveTotal.toPlainString(),null, record.getMerchantId(), null, record.getRemark()); | |||||
| if (receiveTotal.compareTo(new BigDecimal(0)) > 0) { | if (receiveTotal.compareTo(new BigDecimal(0)) > 0) { | ||||
| addreceive.setMoneyDetail(moneyDetail.toString()); | addreceive.setMoneyDetail(moneyDetail.toString()); | ||||
| wxFinanceReceivePaywayMapper.insertPayWays(record.getTenantId(),receivePayWayList); | wxFinanceReceivePaywayMapper.insertPayWays(record.getTenantId(),receivePayWayList); | ||||
| @@ -731,7 +718,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| return noNeedCreate; | return noNeedCreate; | ||||
| } | } | ||||
| public WxFinanceReceive generateReceive(Long receiveId,MallUserInfo user,EnumFinanceCashierType cashierType,EnumFinanceReceiveType type,String receiveMoney,String payMoney,Long merchantId,Long feesId,String remark) { | |||||
| public WxFinanceReceive generateReceive(Long receiveId,MallUserInfo user,EnumFinanceCashierType cashierType,String receiveMoney,String payMoney,Long merchantId,Long feesId,String remark) { | |||||
| WxFinanceReceive addreceive = new WxFinanceReceive(); | WxFinanceReceive addreceive = new WxFinanceReceive(); | ||||
| addreceive.setId(receiveId); | addreceive.setId(receiveId); | ||||
| addreceive.updateTenantInfo(user); | addreceive.updateTenantInfo(user); | ||||
| @@ -751,7 +738,6 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| addreceive.setUpdateByName(user.getName()); | addreceive.setUpdateByName(user.getName()); | ||||
| addreceive.setRemark(remark); | addreceive.setRemark(remark); | ||||
| addreceive.setFeesId(feesId); | addreceive.setFeesId(feesId); | ||||
| addreceive.setReceiveType(type.getCode()); | |||||
| return addreceive; | return addreceive; | ||||
| } | } | ||||
| @@ -778,10 +764,10 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| public void createFinanceReceiveSetoff(WxFinanceReceive addreceive,WxAllBill be,WxAllBill bill) { | public void createFinanceReceiveSetoff(WxFinanceReceive addreceive,WxAllBill be,WxAllBill bill) { | ||||
| for (int j = 0 ; j < be.getSetOffDetailList().size(); j ++ ) { | for (int j = 0 ; j < be.getSetOffDetailList().size(); j ++ ) { | ||||
| FinanceSetOffDetailVo setoffdetail = be.getSetOffDetailList().get(j); | FinanceSetOffDetailVo setoffdetail = be.getSetOffDetailList().get(j); | ||||
| WxFinanceReceive advance = this.getReceiveById(addreceive, setoffdetail.getAdvanceId()); | |||||
| advance.setUseMoney(setoffdetail.getSetoff()); | |||||
| advance.setUpdateTime(new Date()); | |||||
| wxFinanceReceiveMapper.updateById(advance); | |||||
| WxAllBill advance = wxAllBillService.getById(addreceive, setoffdetail.getAdvanceId()); | |||||
| advance.setUseMoney(new BigDecimal(advance.getUseMoney()).add(new BigDecimal(setoffdetail.getSetoff())).toPlainString()); | |||||
| advance.setUpdatetime(new Date()); | |||||
| wxAllBillService.saveOrUpdate(advance, null); | |||||
| //创建一个冲抵收款关联 | //创建一个冲抵收款关联 | ||||
| WxFinanceReceiveSetoff rb = new WxFinanceReceiveSetoff(); | WxFinanceReceiveSetoff rb = new WxFinanceReceiveSetoff(); | ||||
| @@ -837,7 +823,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| List<WxAllBill> bills = record.getBills(); | List<WxAllBill> bills = record.getBills(); | ||||
| sortBills(bills); | sortBills(bills); | ||||
| //创建主收款单 | //创建主收款单 | ||||
| WxFinanceReceive addreceive = generateReceive(receiveId,user,EnumFinanceCashierType.PAY ,EnumFinanceReceiveType.RECEIVE, "0",payTotal.toPlainString(), record.getMerchantId(), null, record.getRemark()); | |||||
| WxFinanceReceive addreceive = generateReceive(receiveId,user,EnumFinanceCashierType.PAY , "0",payTotal.toPlainString(), record.getMerchantId(), null, record.getRemark()); | |||||
| if (payTotal.compareTo(new BigDecimal(0)) > 0) { | if (payTotal.compareTo(new BigDecimal(0)) > 0) { | ||||
| addreceive.setMoneyDetail(moneyDetail.toString()); | addreceive.setMoneyDetail(moneyDetail.toString()); | ||||
| wxFinanceReceivePaywayMapper.insertPayWays(record.getTenantId(),receivePayWayList); | wxFinanceReceivePaywayMapper.insertPayWays(record.getTenantId(),receivePayWayList); | ||||
| @@ -953,40 +939,43 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| return wxFinanceReceiveMapper.selectById(id, tenantEntity.getTenantId()); | return wxFinanceReceiveMapper.selectById(id, tenantEntity.getTenantId()); | ||||
| } | } | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||||
| @Override | @Override | ||||
| public void createAdvance(WxFinanceReceive record,MallUserInfo user) { | |||||
| //创建预收主单 | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| Long receiveId = idWorker.nextId(); | |||||
| WxFinanceReceive addreceive = generateReceive(receiveId,user,EnumFinanceCashierType.RECEIVE ,EnumFinanceReceiveType.ADVANCE, record.getReceiveMoney(), null, | |||||
| record.getMerchantId(), record.getFeesId(), record.getRemark()); | |||||
| wxFinanceReceiveMapper.insert(addreceive); | |||||
| //创建预收账单,只是为了收款列表能够正常展现。 | |||||
| WxAllBill advance = generateAdvanceBillByReceive(record); | |||||
| wxBillAllHelper.saveOrUpdateBill(advance, user); | |||||
| createFinanceReceiveBill(addreceive, advance, record.getReceiveMoney(), null, null); | |||||
| public void createTempFees(WxAllBill record,MallUserInfo user) { | |||||
| WxEnergyFees fq = new WxEnergyFees(); | |||||
| fq.updateTenantInfo(record); | |||||
| fq.setId(record.getEnergyFeesId()); | |||||
| WxEnergyFees fees = wxEnergyService.getFeesById(fq) ; | |||||
| WxMerchant merchant = wxMerchantService.selectById(record.getMerchantId()); | |||||
| if (fees.getBillType().intValue() == EnumBillAllType.ADVANCE.getCode().intValue()) { | |||||
| generateTempBill(record, merchant, user,EnumBillAllType.ADVANCE,EnumBillStatus.SET_OFF); | |||||
| }else if (fees.getBillType().intValue() == EnumBillAllType.OTHER_DEPOSIT.getCode().intValue()) { | |||||
| generateTempBill(record, merchant, user,EnumBillAllType.OTHER_DEPOSIT,EnumBillStatus.WAIT_PAY); | |||||
| }else if (fees.getBillType().intValue() == EnumBillAllType.OTHER.getCode().intValue()) { | |||||
| generateTempBill(record, merchant, user,EnumBillAllType.OTHER,EnumBillStatus.WAIT_PAY); | |||||
| } | |||||
| } | } | ||||
| public WxAllBill generateAdvanceBillByReceive(WxFinanceReceive record) { | |||||
| public void generateTempBill(WxAllBill record,WxMerchant merchant,MallUserInfo user, EnumBillAllType billType,EnumBillStatus billStatus ) { | |||||
| WxAllBill advanceBill = new WxAllBill(); | WxAllBill advanceBill = new WxAllBill(); | ||||
| advanceBill.updateTenantInfo(record); | advanceBill.updateTenantInfo(record); | ||||
| advanceBill.setMerchantId(record.getMerchantId()); | |||||
| advanceBill.setRentShopType(record.getRentShopType()); | |||||
| advanceBill.setNeedPay(record.getReceiveMoney()); | |||||
| advanceBill.setReceivePay(record.getReceiveMoney()); | |||||
| advanceBill.setPay(record.getReceiveMoney()); | |||||
| advanceBill.setBillType(EnumBillAllType.ADVANCE.getCode()); | |||||
| advanceBill.setMerchantId(merchant.getId()); | |||||
| advanceBill.setRentShopType(merchant.getRentShopType()); | |||||
| advanceBill.setNeedPay(record.getReceivePay()); | |||||
| advanceBill.setReceivePay(record.getReceivePay()); | |||||
| advanceBill.setPay("0"); | |||||
| advanceBill.setUseMoney("0"); | |||||
| advanceBill.setBillType(billType.getCode()); | |||||
| //advanceBill.setPayWay(); | //advanceBill.setPayWay(); | ||||
| advanceBill.setPayDate(new Date()); | advanceBill.setPayDate(new Date()); | ||||
| advanceBill.setStarttime(DateUtils.getDayBegin(new Date())); | |||||
| advanceBill.setEndtime(DateUtils.getDayEnd(new Date())); | |||||
| advanceBill.setStatus(EnumBillStatus.SET_OFF.getCode()); | |||||
| advanceBill.setEnergyFeesId(record.getFeesId()); | |||||
| advanceBill.setStarttime(record.getStarttime()); | |||||
| advanceBill.setEndtime(record.getEndtime()); | |||||
| advanceBill.setStatus(billStatus.getCode()); | |||||
| advanceBill.setEnergyFeesId(record.getEnergyFeesId()); | |||||
| advanceBill.setIsPreview(EnumYesOrNo.NO.getCode()); | advanceBill.setIsPreview(EnumYesOrNo.NO.getCode()); | ||||
| return advanceBill; | |||||
| advanceBill.setBillRemark(record.getBillRemark()); | |||||
| wxBillAllHelper.saveOrUpdateBill(advanceBill, user); | |||||
| } | } | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| @Override | @Override | ||||
| public void invalidReceive(WxFinanceReceive record, MallUserInfo user,String remark) { | public void invalidReceive(WxFinanceReceive record, MallUserInfo user,String remark) { | ||||
| @@ -994,18 +983,6 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| } | } | ||||
| public void invalidReceive(WxFinanceReceive record, MallUserInfo user,boolean isRedSetoff) { | public void invalidReceive(WxFinanceReceive record, MallUserInfo user,boolean isRedSetoff) { | ||||
| //如果自身是预充单,则被冲抵了就不能作废 | |||||
| if (record.getType().intValue() == EnumFinanceCashierType.RECEIVE.getCode().intValue() && | |||||
| record.getReceiveType().intValue() == EnumFinanceReceiveType.ADVANCE.getCode().intValue()) { | |||||
| WxFinanceReceiveSetoff rsq0 = new WxFinanceReceiveSetoff(); | |||||
| rsq0.updateTenantInfo(record); | |||||
| rsq0.setAdvanceId(record.getId()); | |||||
| rsq0.setIsDel(EnumYesOrNo.NO.getCode()); | |||||
| Integer count = wxFinanceReceiveSetoffMapper.findCount(rsq0); | |||||
| if (null != count && count > 0 ) { | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"存在关联的冲抵单,请先处理"); | |||||
| } | |||||
| } | |||||
| //主收款单作废 | //主收款单作废 | ||||
| record.setStatus(EnumFinanceReceiveStatus.INVALID.getCode()); | record.setStatus(EnumFinanceReceiveStatus.INVALID.getCode()); | ||||
| record.setUpdateTime(new Date()); | record.setUpdateTime(new Date()); | ||||
| @@ -1072,9 +1049,9 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| if (null != setoffList) { | if (null != setoffList) { | ||||
| for (int j = 0 ; j < setoffList.size() ; j ++) { | for (int j = 0 ; j < setoffList.size() ; j ++) { | ||||
| WxFinanceReceiveSetoff rs = setoffList.get(j); | WxFinanceReceiveSetoff rs = setoffList.get(j); | ||||
| WxFinanceReceive advance = this.getReceiveById(record, rs.getAdvanceId()); | |||||
| if (advance.getStatus().intValue() != EnumFinanceReceiveStatus.NORMAL.getCode().intValue()) { | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"关联的预充单["+advance.getId()+"]已被锁定,无法修改"); | |||||
| WxAllBill advance = wxAllBillService.getById(record, rs.getAdvanceId()); | |||||
| if (advance.getStatus().intValue() != EnumBillStatus.SET_OFF.getCode().intValue()) { | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"关联的预充账单["+advance.getId()+"]状态无法修改"); | |||||
| } | } | ||||
| BigDecimal advanceUserMoney = new BigDecimal(0); | BigDecimal advanceUserMoney = new BigDecimal(0); | ||||
| if (StringUtils.isNotBlank(advance.getUseMoney())) { | if (StringUtils.isNotBlank(advance.getUseMoney())) { | ||||
| @@ -1084,7 +1061,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| record.setUpdateTime(new Date()); | record.setUpdateTime(new Date()); | ||||
| record.setUpdateBy(user.getId()); | record.setUpdateBy(user.getId()); | ||||
| record.setUpdateByName(user.getName()); | record.setUpdateByName(user.getName()); | ||||
| wxFinanceReceiveMapper.updateById(advance); | |||||
| wxAllBillService.saveOrUpdate(advance, user); | |||||
| } | } | ||||
| } | } | ||||
| //要更新账单的冲抵 | //要更新账单的冲抵 | ||||
| @@ -1137,9 +1114,6 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| if (StringUtils.isNotBlank(record.getPayMoney())) { | if (StringUtils.isNotBlank(record.getPayMoney())) { | ||||
| record.setPayMoney("-"+record.getPayMoney()); | record.setPayMoney("-"+record.getPayMoney()); | ||||
| } | } | ||||
| if (StringUtils.isNotBlank(record.getUseMoney())) { | |||||
| record.setUseMoney("-"+record.getUseMoney()); | |||||
| } | |||||
| record.setStatus(EnumFinanceReceiveStatus.RED_SETOFF.getCode()); | record.setStatus(EnumFinanceReceiveStatus.RED_SETOFF.getCode()); | ||||
| wxFinanceReceiveMapper.insert(record); | wxFinanceReceiveMapper.insert(record); | ||||
| @@ -21,6 +21,7 @@ | |||||
| <result column="pay_way" jdbcType="BIGINT" property="payWay"/> | <result column="pay_way" jdbcType="BIGINT" property="payWay"/> | ||||
| <result column="pay_date" jdbcType="TIMESTAMP" property="payDate"/> | <result column="pay_date" jdbcType="TIMESTAMP" property="payDate"/> | ||||
| <result column="set_off" jdbcType="VARCHAR" property="setOff"/> | <result column="set_off" jdbcType="VARCHAR" property="setOff"/> | ||||
| <result column="use_money" jdbcType="VARCHAR" property="useMoney"/> | |||||
| <result column="starttime" jdbcType="TIMESTAMP" property="starttime"/> | <result column="starttime" jdbcType="TIMESTAMP" property="starttime"/> | ||||
| <result column="endtime" jdbcType="TIMESTAMP" property="endtime"/> | <result column="endtime" jdbcType="TIMESTAMP" property="endtime"/> | ||||
| <result column="status" jdbcType="INTEGER" property="status"/> | <result column="status" jdbcType="INTEGER" property="status"/> | ||||
| @@ -47,7 +48,7 @@ | |||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`parent_tenant_id`,`merchant_id`,`rent_shop_type`,`createtime`,`create_by`,`create_by_name`,`updatetime`,`update_by`,`update_by_name`, | `id`,`tenant_id`,`parent_tenant_id`,`merchant_id`,`rent_shop_type`,`createtime`,`create_by`,`create_by_name`,`updatetime`,`update_by`,`update_by_name`, | ||||
| `price_detail`,`need_pay`,`receive_pay`,`pay`,`bill_type`,`pay_way`,`pay_date`,`set_off`,`starttime`,`endtime`,`status`,`energy_fees_id`,`return_pay`, | |||||
| `price_detail`,`need_pay`,`receive_pay`,`pay`,`bill_type`,`pay_way`,`pay_date`,`set_off`,`use_money`,`starttime`,`endtime`,`status`,`energy_fees_id`,`return_pay`, | |||||
| `bill_remark`,`last_owe_call_time`,`last_owe_call_user`,`bussiness_manage_fee_need_pay`,`operating_manage_fee_need_pay`,`shop_id`,`shop_number`, | `bill_remark`,`last_owe_call_time`,`last_owe_call_user`,`bussiness_manage_fee_need_pay`,`operating_manage_fee_need_pay`,`shop_id`,`shop_number`, | ||||
| `is_preview`,`shop_info`,`rent_contract_id`,`property_contract_id`,`parent_bill_id`,`energy_reading_calcuteId`,`energy_reading_id`,`extra_create_from` | `is_preview`,`shop_info`,`rent_contract_id`,`property_contract_id`,`parent_bill_id`,`energy_reading_calcuteId`,`energy_reading_id`,`extra_create_from` | ||||
| </sql> | </sql> | ||||
| @@ -74,6 +75,7 @@ | |||||
| <if test=" null != endtimeEqual">and `endtime` = #{endtimeEqual}</if> | <if test=" null != endtimeEqual">and `endtime` = #{endtimeEqual}</if> | ||||
| <if test=" null != extraCreateFrom">and `extra_create_from` = #{extraCreateFrom}</if> | <if test=" null != extraCreateFrom">and `extra_create_from` = #{extraCreateFrom}</if> | ||||
| <if test=" null != noExtraCreateFrom">and `extra_create_from` is null</if> | <if test=" null != noExtraCreateFrom">and `extra_create_from` is null</if> | ||||
| <if test=" null != advanceHasMoney">and bill_type = 9 and IFNULL(`pay`,'0') - IFNULL(`use_money`,'0') > 0</if> | |||||
| <if test=" null != month and '' != month"> | <if test=" null != month and '' != month"> | ||||
| and date_format(starttime,'%Y-%m') <= #{month} and date_format(endtime,'%Y-%m') >= #{month} | and date_format(starttime,'%Y-%m') <= #{month} and date_format(endtime,'%Y-%m') >= #{month} | ||||
| </if> | </if> | ||||
| @@ -100,7 +102,7 @@ | |||||
| </if> | </if> | ||||
| <if test=" null != needPayNoDays"> | <if test=" null != needPayNoDays"> | ||||
| and ( | and ( | ||||
| ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') > 0 and status not in (3,6,7,9) and bill_type not in (13,21,5)) | |||||
| ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') > 0 and status not in (3,6,7) and bill_type not in (13,21,5)) | |||||
| or | or | ||||
| ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and status not in (3,6,7,9) and bill_type in (13,21,5)) | ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and status not in (3,6,7,9) and bill_type in (13,21,5)) | ||||
| ) | ) | ||||
| @@ -190,6 +192,13 @@ | |||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| </select> | </select> | ||||
| <select id="getMerchantAdvanceGroupSumList" parameterType="com.iformall.domain.po.WxAllBill" resultMap="BaseResultMap"> | |||||
| select energy_fees_id, sum(CAST(pay AS DECIMAL(20,2))) pay , sum(CAST(ifnull(use_money,'0') AS DECIMAL(20,2))) use_money | |||||
| from wx_all_bill | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| group by energy_fees_id | |||||
| </select> | |||||
| <resultMap id="SumBaseResultMap" type="com.iformall.domain.vo.WxBillSum"> | <resultMap id="SumBaseResultMap" type="com.iformall.domain.vo.WxBillSum"> | ||||
| <result column="receive_pay" jdbcType="VARCHAR" property="needPay"/> | <result column="receive_pay" jdbcType="VARCHAR" property="needPay"/> | ||||
| <result column="paid" jdbcType="VARCHAR" property="paid" /> | <result column="paid" jdbcType="VARCHAR" property="paid" /> | ||||
| @@ -202,11 +211,11 @@ | |||||
| <select id="getBillMonthSum" parameterType="com.iformall.domain.po.WxAllBill" resultMap="SumBaseResultMap"> | <select id="getBillMonthSum" parameterType="com.iformall.domain.po.WxAllBill" resultMap="SumBaseResultMap"> | ||||
| select | select | ||||
| sum(CAST(receive_pay AS DECIMAL(20,2))) receive_pay , | sum(CAST(receive_pay AS DECIMAL(20,2))) receive_pay , | ||||
| sum(CAST(pay AS DECIMAL(20,2))) paid, | |||||
| sum(CAST(ifnull(pay,'0') AS DECIMAL(20,2))) paid, | |||||
| min(starttime) min_date, | min(starttime) min_date, | ||||
| max(endtime) max_date, | max(endtime) max_date, | ||||
| sum(CAST(set_off AS DECIMAL(20,2))) set_off , | |||||
| sum(CAST(return_pay AS DECIMAL(20,2))) return_pay | |||||
| sum(CAST(ifnull(set_off,'0') AS DECIMAL(20,2))) set_off , | |||||
| sum(CAST(ifnull(return_pay,'0') AS DECIMAL(20,2))) return_pay | |||||
| from wx_all_bill | from wx_all_bill | ||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| </select> | </select> | ||||
| @@ -214,11 +223,11 @@ | |||||
| select | select | ||||
| energy_fees_id, | energy_fees_id, | ||||
| sum(CAST(receive_pay AS DECIMAL(20,2))) receive_pay , | sum(CAST(receive_pay AS DECIMAL(20,2))) receive_pay , | ||||
| sum(CAST(pay AS DECIMAL(20,2))) paid, | |||||
| sum(CAST(ifnull(pay,'0') AS DECIMAL(20,2))) paid, | |||||
| min(starttime) min_date, | min(starttime) min_date, | ||||
| max(endtime) max_date, | max(endtime) max_date, | ||||
| sum(CAST(set_off AS DECIMAL(20,2))) set_off , | |||||
| sum(CAST(return_pay AS DECIMAL(20,2))) return_pay | |||||
| sum(CAST(ifnull(set_off,'0)' AS DECIMAL(20,2))) set_off , | |||||
| sum(CAST(ifnull(return_pay,'0') AS DECIMAL(20,2))) return_pay | |||||
| from wx_all_bill | from wx_all_bill | ||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| group by energy_fees_id | group by energy_fees_id | ||||
| @@ -331,7 +340,7 @@ | |||||
| ( | ( | ||||
| #{item.id},#{item.tenantId},#{item.parentTenantId},#{item.merchantId},#{item.rentShopType},#{item.createtime}, | #{item.id},#{item.tenantId},#{item.parentTenantId},#{item.merchantId},#{item.rentShopType},#{item.createtime}, | ||||
| #{item.createBy},#{item.createByName},#{item.updatetime},#{item.updateBy},#{item.updateByName},#{item.priceDetail}, | #{item.createBy},#{item.createByName},#{item.updatetime},#{item.updateBy},#{item.updateByName},#{item.priceDetail}, | ||||
| #{item.needPay},#{item.receivePay},#{item.pay},#{item.billType},#{item.payWay},#{item.payDate},#{item.setOff}, | |||||
| #{item.needPay},#{item.receivePay},#{item.pay},#{item.billType},#{item.payWay},#{item.payDate},#{item.setOff},#{item.useMoney}, | |||||
| #{item.starttime},#{item.endtime},#{item.status},#{item.energyFeesId},#{item.returnPay},#{item.billRemark}, | #{item.starttime},#{item.endtime},#{item.status},#{item.energyFeesId},#{item.returnPay},#{item.billRemark}, | ||||
| #{item.lastOweCallTime},#{item.lastOweCallUser},#{item.bussinessManageFeeNeedPay},#{item.operatingManageFeeNeedPay}, | #{item.lastOweCallTime},#{item.lastOweCallUser},#{item.bussinessManageFeeNeedPay},#{item.operatingManageFeeNeedPay}, | ||||
| #{item.shopId},#{item.shopNumber},#{item.isPreview},#{item.shopInfo},#{item.rentContractId},#{item.propertyContractId}, | #{item.shopId},#{item.shopNumber},#{item.isPreview},#{item.shopInfo},#{item.rentContractId},#{item.propertyContractId}, | ||||
| @@ -68,6 +68,12 @@ | |||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| </select> | </select> | ||||
| <select id="findIdList" parameterType="com.iformall.domain.po.WxEnergyFees" resultType="Long"> | |||||
| select id | |||||
| from wx_energy_fees | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap"> | <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap"> | ||||
| select | select | ||||
| <include refid="allColumns"/> | <include refid="allColumns"/> | ||||
| @@ -10,10 +10,8 @@ | |||||
| <result column="receive_money" jdbcType="VARCHAR" property="receiveMoney"/> | <result column="receive_money" jdbcType="VARCHAR" property="receiveMoney"/> | ||||
| <result column="pay_money" jdbcType="VARCHAR" property="payMoney"/> | <result column="pay_money" jdbcType="VARCHAR" property="payMoney"/> | ||||
| <result column="set_off_money" jdbcType="VARCHAR" property="setOffMoney"/> | <result column="set_off_money" jdbcType="VARCHAR" property="setOffMoney"/> | ||||
| <result column="use_money" jdbcType="VARCHAR" property="useMoney"/> | |||||
| <result column="status" jdbcType="INTEGER" property="status"/> | <result column="status" jdbcType="INTEGER" property="status"/> | ||||
| <result column="type" jdbcType="INTEGER" property="type"/> | <result column="type" jdbcType="INTEGER" property="type"/> | ||||
| <result column="receive_type" jdbcType="INTEGER" property="receiveType"/> | |||||
| <result column="money_detail" jdbcType="VARCHAR" property="moneyDetail"/> | <result column="money_detail" jdbcType="VARCHAR" property="moneyDetail"/> | ||||
| <result column="create_by" jdbcType="BIGINT" property="createBy"/> | <result column="create_by" jdbcType="BIGINT" property="createBy"/> | ||||
| <result column="create_by_name" jdbcType="VARCHAR" property="createByName"/> | <result column="create_by_name" jdbcType="VARCHAR" property="createByName"/> | ||||
| @@ -28,8 +26,8 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`receive_money`,`pay_money`,`set_off_money`,`use_money`,`status`,`type`, | |||||
| `receive_type`,`money_detail`,`create_by`,`create_by_name`,`update_by`,`update_by_name`,`merchant_id`,`rent_shop_type`,`remark`, | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`receive_money`,`pay_money`,`set_off_money`,`status`,`type`, | |||||
| `money_detail`,`create_by`,`create_by_name`,`update_by`,`update_by_name`,`merchant_id`,`rent_shop_type`,`remark`, | |||||
| `fees_id`,`is_print`,`is_finish` | `fees_id`,`is_print`,`is_finish` | ||||
| </sql> | </sql> | ||||
| @@ -44,7 +42,6 @@ | |||||
| </if> | </if> | ||||
| <if test=" null != status ">and `status` = #{status}</if> | <if test=" null != status ">and `status` = #{status}</if> | ||||
| <if test=" null != type ">and `type` = #{type}</if> | <if test=" null != type ">and `type` = #{type}</if> | ||||
| <if test=" null != receiveType ">and `receive_type` = #{receiveType}</if> | |||||
| <if test=" null != merchantId ">and `merchant_id` = #{merchantId}</if> | <if test=" null != merchantId ">and `merchant_id` = #{merchantId}</if> | ||||
| <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | ||||
| <if test=" null != createTimeBegin ">and `create_time` >= #{createTimeBegin}</if> | <if test=" null != createTimeBegin ">and `create_time` >= #{createTimeBegin}</if> | ||||
| @@ -54,7 +51,6 @@ | |||||
| <if test=" null != isPrint ">and `is_print` = #{isPrint}</if> | <if test=" null != isPrint ">and `is_print` = #{isPrint}</if> | ||||
| <if test=" null != isFinish ">and `is_finish` = #{isFinish}</if> | <if test=" null != isFinish ">and `is_finish` = #{isFinish}</if> | ||||
| <if test=" null != finishStatus ">and `status` in (1,3)</if> | <if test=" null != finishStatus ">and `status` in (1,3)</if> | ||||
| <if test=" null != hasExtraMoney ">and receive_money - IFNULL(use_money,'0') > 0</if> | |||||
| <if test=" null != merchantIdList "> | <if test=" null != merchantIdList "> | ||||
| and merchant_id in | and merchant_id in | ||||
| <foreach collection="merchantIdList" index="index" item="midItem" open="(" separator="," close=")"> | <foreach collection="merchantIdList" index="index" item="midItem" open="(" separator="," close=")"> | ||||
| @@ -99,15 +95,6 @@ | |||||
| update wx_finance_receive set is_del = #{isDel} where id = #{id} and `tenant_id` = #{tenantId} | update wx_finance_receive set is_del = #{isDel} where id = #{id} and `tenant_id` = #{tenantId} | ||||
| </update> | </update> | ||||
| <select id="getMerchantAdvanceGroupSumList" parameterType="com.iformall.domain.po.WxFinanceReceive" resultMap="BaseResultMap"> | |||||
| select fees_id,sum(CAST(receive_money AS DECIMAL(20,4))) as receive_money,sum(CAST(IFNULL(use_money,'0') AS DECIMAL(20,4))) as use_money | |||||
| from wx_finance_receive | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| and receive_money - IFNULL(use_money,'0') > 0 | |||||
| group by fees_id | |||||
| </select> | |||||
| <resultMap id="SumResultMap" type="com.iformall.domain.vo.WxFinanceReceiveSumVo"> | <resultMap id="SumResultMap" type="com.iformall.domain.vo.WxFinanceReceiveSumVo"> | ||||
| <result column="total_receive" jdbcType="VARCHAR" property="totalReceive"/> | <result column="total_receive" jdbcType="VARCHAR" property="totalReceive"/> | ||||
| <result column="total_setoff" jdbcType="VARCHAR" property="totalSetoff" /> | <result column="total_setoff" jdbcType="VARCHAR" property="totalSetoff" /> | ||||