| @@ -163,7 +163,7 @@ public class ShiroConfig { | |||
| filterChainDefinitionMap.put("/logout", "authc"); | |||
| filterChainDefinitionMap.put("/**", "corsFilter,token,authc"); | |||
| // filterChainDefinitionMap.put("/**", "anon"); | |||
| filterChainDefinitionMap.put("/**", "anon"); | |||
| shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap); | |||
| @@ -52,13 +52,13 @@ public class BaseController { | |||
| }); | |||
| } | |||
| public MallUserInfo getUser(){ | |||
| MallUserInfo user = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); | |||
| // MallUserInfo user = new MallUserInfo(); | |||
| // user.setId(321127266275430400L); | |||
| // user.setName("alitest"); | |||
| // user.setTenantId("789"); | |||
| // user.setParentTenantId(null); | |||
| // user.setIsAdmin(1); | |||
| // MallUserInfo user = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); | |||
| MallUserInfo user = new MallUserInfo(); | |||
| user.setId(321127266275430400L); | |||
| user.setName("alitest"); | |||
| user.setTenantId("789"); | |||
| user.setParentTenantId(null); | |||
| user.setIsAdmin(1); | |||
| return user; | |||
| } | |||
| @@ -80,10 +80,10 @@ public class BaseController { | |||
| */ | |||
| public TenantEntity getTenantInfo(){ | |||
| Session session = SecurityUtils.getSubject().getSession(); | |||
| String tenantId = (String)session.getAttribute(UserSession.tenantId); | |||
| String parentTenantId = (String)session.getAttribute(UserSession.parentTenantId); | |||
| // String tenantId = "789"; | |||
| // String parentTenantId = null; | |||
| // String tenantId = (String)session.getAttribute(UserSession.tenantId); | |||
| // String parentTenantId = (String)session.getAttribute(UserSession.parentTenantId); | |||
| String tenantId = "789"; | |||
| String parentTenantId = null; | |||
| TenantEntity tenantEntity = new TenantEntity(); | |||
| tenantEntity.setTenantId(tenantId); | |||
| tenantEntity.setParentTenantId(parentTenantId); | |||
| @@ -35,6 +35,7 @@ import com.iformall.service.SysConfigService; | |||
| import com.iformall.service.WxEnergyService; | |||
| import com.iformall.service.WxFinanceService; | |||
| import com.iformall.service.WxFlowService; | |||
| import com.iformall.utils.DateUtils; | |||
| import com.iformall.utils.StringContentUtils; | |||
| import io.swagger.annotations.Api; | |||
| @@ -45,6 +46,7 @@ import io.swagger.annotations.ApiOperation; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.net.URLDecoder; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @@ -72,8 +74,6 @@ public class WxFinanceController extends BaseController { | |||
| @Autowired | |||
| WxEnergyService wxEnergyService; | |||
| @Autowired | |||
| private SysConfigService sysConfigService; | |||
| @Autowired | |||
| WxFlowService wxFlowService; | |||
| /** | |||
| @@ -267,6 +267,9 @@ public class WxFinanceController extends BaseController { | |||
| if (null == record.getMerchantId()) { | |||
| return new ResultData(Result.ERROR,"请选择商户"); | |||
| } | |||
| if (!this.isValidPayTime(record.getReceiveDate())) { | |||
| return new ResultData(Result.ERROR,"支付时间请在结账截止时间之后"); | |||
| } | |||
| wxFinanceService.createTempFees(record,this.getUser()); | |||
| return new ResultData(); | |||
| } | |||
| @@ -303,6 +306,9 @@ public class WxFinanceController extends BaseController { | |||
| if (null == record.getBills() || null == record.getPayWays()) { | |||
| return new ResultData(Result.ERROR,"请选择账单和支付方式"); | |||
| } | |||
| if (!this.isValidPayTime(record.getReceiveDate())) { | |||
| return new ResultData(Result.ERROR,"支付时间请在结账截止时间之后"); | |||
| } | |||
| Map map = wxFinanceService.createReceive(record,this.getUser()); | |||
| return new ResultData(map); | |||
| } | |||
| @@ -331,6 +337,9 @@ public class WxFinanceController extends BaseController { | |||
| if (null == record.getBills() || null == record.getPayWays()) { | |||
| return new ResultData(Result.ERROR,"请选择账单和支付方式"); | |||
| } | |||
| if (!this.isValidPayTime(record.getReceiveDate())) { | |||
| return new ResultData(Result.ERROR,"支付时间请在结账截止时间之后"); | |||
| } | |||
| Map map = wxFinanceService.createPay(record,this.getUser()); | |||
| return new ResultData(map); | |||
| } | |||
| @@ -348,6 +357,9 @@ public class WxFinanceController extends BaseController { | |||
| if (null == record.getMerchantId()) { | |||
| return new ResultData(Result.ERROR,"请选择商户"); | |||
| } | |||
| if (!this.isValidPayTime(record.getReceiveDate())) { | |||
| return new ResultData(Result.ERROR,"支付时间请在结账截止时间之后"); | |||
| } | |||
| wxFinanceService.createTempToPay(record,this.getUser()); | |||
| return new ResultData(); | |||
| } | |||
| @@ -544,10 +556,6 @@ public class WxFinanceController extends BaseController { | |||
| return new ResultData(Result.ERROR,"finishId参数不能为空"); | |||
| } | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| WxFinanceFinish finish = wxFinanceService.getFinishById(record, record.getFinishId()); | |||
| record.setCreateTimeBegin(finish.getStartDate()); | |||
| record.setCreateTimeEnd(finish.getEndDate()); | |||
| record.setFinishStatus(EnumYesOrNo.YES.getCode()); | |||
| record.setSortColumns("status asc,create_time asc"); | |||
| PageInfo<WxFinanceReceiveVo> page = wxFinanceService.receiveVoListAsPage(record, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -560,10 +568,6 @@ public class WxFinanceController extends BaseController { | |||
| return new ResultData(Result.ERROR,"finishId参数不能为空"); | |||
| } | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| WxFinanceFinish finish = wxFinanceService.getFinishById(record, record.getFinishId()); | |||
| record.setCreateTimeBegin(finish.getStartDate()); | |||
| record.setCreateTimeEnd(finish.getEndDate()); | |||
| record.setFinishStatus(EnumYesOrNo.YES.getCode()); | |||
| WxFinanceReceiveSumVo page = wxFinanceService.getReceiveSum(record); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -590,8 +594,6 @@ public class WxFinanceController extends BaseController { | |||
| WxFinanceReceive rq = new WxFinanceReceive(); | |||
| rq.setCreateTimeBegin(finish.getStartDate()); | |||
| rq.setCreateTimeEnd(finish.getEndDate()); | |||
| //正常和已红冲的都可以结账 | |||
| rq.setFinishStatus(EnumYesOrNo.YES.getCode()); | |||
| rq.setIsFinish(EnumYesOrNo.NO.getCode()); | |||
| rq.updateTenantInfo(record); | |||
| Integer count = wxFinanceService.getReceiveUnFinisedCount(rq); | |||
| @@ -607,8 +609,20 @@ public class WxFinanceController extends BaseController { | |||
| @ApiOperation("截止时间") | |||
| @GetMapping("getReceiveEndTime") | |||
| public ResultData getReceiveEndTime() { | |||
| SysConfig config = sysConfigService.getByKey(SysConfigConstant.finance_receive_end_date, getTenantInfo()); | |||
| return new ResultData(config); | |||
| return new ResultData(wxFinanceService.getFinishEndTime(this.getTenantInfo())); | |||
| } | |||
| private boolean isValidPayTime(Date date) { | |||
| SysConfig sysconfig = wxFinanceService.getFinishEndTime(this.getTenantInfo()); | |||
| String fdatestr = sysconfig.getConfigItemValue(); | |||
| if (StringUtils.isBlank(fdatestr)) { | |||
| return true; | |||
| } | |||
| Date fdate = DateUtils.stringToDate(fdatestr, DateUtils.DATE_TIME_PATTERN); | |||
| if (date.after(fdate)) { | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| } | |||
| @@ -42,6 +42,10 @@ public class WxFinanceReceive extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="支付时间",name="receiveDate") | |||
| private Date receiveDate; | |||
| @TableField(exist = false) | |||
| private Date receiveDateBegin; | |||
| @TableField(exist = false) | |||
| private Date receiveDateEnd; | |||
| @io.swagger.annotations.ApiModelProperty(value="科目ID,预收的时候有",name="feesId") | |||
| private Long feesId; | |||
| @@ -182,8 +186,6 @@ public class WxFinanceReceive extends TenantEntity { | |||
| @TableField(exist = false) | |||
| private String shopIds; | |||
| @TableField(exist = false) | |||
| private Integer finishStatus; | |||
| @TableField(exist = false) | |||
| private Long finishId; | |||
| @TableField(exist = false) | |||
| private Map<String, Object> flowParams; | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.service; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @@ -8,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestBody; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.dto.FinanceSetOffDTO; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.SysConfig; | |||
| import com.iformall.domain.po.WxAllBill; | |||
| import com.iformall.domain.po.WxBillPayWay; | |||
| import com.iformall.domain.po.WxFinanceFinish; | |||
| @@ -63,4 +65,5 @@ public interface WxFinanceService { | |||
| void finishReceive(WxFinanceFinish record,MallUserInfo user); | |||
| Integer getReceiveUnFinisedCount(WxFinanceReceive record); | |||
| void batchFinishReceive(WxFinanceFinish record,MallUserInfo user,boolean isAll); | |||
| SysConfig getFinishEndTime(TenantEntity tenantEntity); | |||
| } | |||
| @@ -6,11 +6,13 @@ import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.SysConfigConstant; | |||
| import com.iformall.domain.dto.FinanceReceiveCalcuteDTO; | |||
| import com.iformall.domain.dto.FinanceSetOffCalcuteDTO; | |||
| import com.iformall.domain.dto.FinanceSetOffDTO; | |||
| import com.iformall.domain.dto.WxBillPayDTO; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.SysConfig; | |||
| import com.iformall.domain.po.WxAllBill; | |||
| import com.iformall.domain.po.WxBillPayWay; | |||
| import com.iformall.domain.po.WxEnergyFees; | |||
| @@ -47,6 +49,7 @@ import com.iformall.mapper.WxFinanceReceiveBillMapper; | |||
| import com.iformall.mapper.WxFinanceReceiveMapper; | |||
| import com.iformall.mapper.WxFinanceReceivePaywayMapper; | |||
| import com.iformall.mapper.WxFinanceReceiveSetoffMapper; | |||
| import com.iformall.service.SysConfigService; | |||
| import com.iformall.service.WxAllBillService; | |||
| import com.iformall.service.WxEnergyService; | |||
| import com.iformall.service.WxFinanceService; | |||
| @@ -115,6 +118,9 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| @Lazy | |||
| @Autowired | |||
| WxAllBillService wxAllBillService; | |||
| @Lazy | |||
| @Autowired | |||
| private SysConfigService sysConfigService; | |||
| @@ -422,6 +428,12 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| if (queryMerchantIds.size() > 0 ) { | |||
| record.setMerchantIdList(queryMerchantIds); | |||
| } | |||
| if (null != record.getFinishId()) { | |||
| WxFinanceFinish finish = wxFinanceFinishMapper.selectById(record.getFinishId(), record.getTenantId()); | |||
| record.setReceiveDateBegin(finish.getStartDate()); | |||
| record.setReceiveDateEnd(finish.getEndDate()); | |||
| } | |||
| } | |||
| private PageInfo<WxFinanceReceiveVo> receiveVoListAsPage(WxFinanceReceive record, Integer pageIndex, Integer pageSize,boolean hasBills) { | |||
| @@ -949,11 +961,8 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| @Override | |||
| public Map createCut(WxFinanceReceive record,MallUserInfo user) { | |||
| //单保存冲抵的时候,实收金额为0 | |||
| BigDecimal receiveTotal = new BigDecimal(0); | |||
| //WxBillPayWay payWay0 = null; | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| Long receiveId = idWorker.nextId(); | |||
| List<WxFinanceReceivePayway> receivePayWayList = new ArrayList<WxFinanceReceivePayway>(); | |||
| //冲抵总金额 | |||
| List<WxAllBill> bills = record.getBills(); | |||
| @@ -1506,9 +1515,8 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| //更新收付款记录 | |||
| WxFinanceReceive fr = new WxFinanceReceive(); | |||
| fr.updateTenantInfo(record); | |||
| fr.setCreateTimeBegin(finish.getStartDate()); | |||
| fr.setCreateTimeEnd(finish.getEndDate()); | |||
| fr.setFinishStatus(EnumYesOrNo.YES.getCode()); | |||
| fr.setReceiveDateBegin(finish.getStartDate()); | |||
| fr.setReceiveDateEnd(finish.getEndDate()); | |||
| fr.setIsFinish(EnumYesOrNo.NO.getCode()); | |||
| wxFinanceReceiveMapper.finish(fr); | |||
| } | |||
| @@ -1539,4 +1547,9 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| } | |||
| } | |||
| @Override | |||
| public SysConfig getFinishEndTime(TenantEntity tenantEntity) { | |||
| return sysConfigService.getByKey(SysConfigConstant.finance_receive_end_date, tenantEntity); | |||
| } | |||
| } | |||
| @@ -48,11 +48,12 @@ | |||
| <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | |||
| <if test=" null != createTimeBegin ">and `create_time` >= #{createTimeBegin}</if> | |||
| <if test=" null != createTimeEnd ">and `create_time` <= #{createTimeEnd}</if> | |||
| <if test=" null != receiveDateBegin ">and `receive_date` >= #{receiveDateBegin}</if> | |||
| <if test=" null != receiveDateEnd ">and `receive_date` <= #{receiveDateEnd}</if> | |||
| <if test=" null != feesId ">and `fees_id` = #{feesId}</if> | |||
| <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | |||
| <if test=" null != isPrint ">and `is_print` = #{isPrint}</if> | |||
| <if test=" null != isFinish ">and `is_finish` = #{isFinish}</if> | |||
| <if test=" null != finishStatus ">and `status` in (1,3)</if> | |||
| <if test=" null != merchantIdList "> | |||
| and merchant_id in | |||
| <foreach collection="merchantIdList" index="index" item="midItem" open="(" separator="," close=")"> | |||
| @@ -126,6 +127,7 @@ | |||
| <update id="finish" parameterType="com.iformall.domain.po.WxFinanceReceive"> | |||
| update wx_finance_receive set is_finish = 1 | |||
| <include refid="dynamicWhereConditions"/> | |||
| and status not in (2,3,4) | |||
| </update> | |||
| <update id="updatePrint" parameterType="com.iformall.domain.po.WxFinanceReceive"> | |||