src/main/java/com/zy/crm/manager/entity/CompanyMoney.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/crm/manager/mapper/CompanyMoneyMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/crm/manager/service/CompanyMoneyService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/crm/manager/service/impl/CompanyMoneyServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/crm/manager/task/CstmrCopyScheduler.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/crm/manager/task/handler/CstmrCopyHandler.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/CompanyMoneyMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/webapp/views/cstmr/cstmr.html | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/zy/crm/manager/entity/CompanyMoney.java
@@ -73,14 +73,80 @@ private Long orderId; /** * 项目ID */ @ApiModelProperty(value= "项目ID") @TableField("cstmr_id") private Long cstmrId; /** * 实际收款 */ @ApiModelProperty(value= "实际收款") @TableField("actual_receipts") private Double actualReceipts; /** * 余款 */ @ApiModelProperty(value= "余款") @TableField("balance_now") private Double balanceNow; /** * 余款 */ @ApiModelProperty(value= "0:未结销、1:部分结销、2:已结销") private Integer status; @ApiModelProperty(value = "") private String memo; @ApiModelProperty(value= "") @TableField("delivery_time") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private Date deliveryTime; @ApiModelProperty(value = "") @TableField("cstmr_name") private String cstmrName; @ApiModelProperty(value = "") @TableField("user_name") private String userName; @ApiModelProperty(value = "") @TableField("receivables_type") private Integer receivablesType; @ApiModelProperty(value = "") @TableField("receivables_type_name") private String receivablesTypeName; public CompanyMoney() {} public CompanyMoney(CompanyMoney companyMoney) { this.year = companyMoney.getYear(); this.receivables = companyMoney.getReceivables(); this.createTime = companyMoney.getCreateTime(); this.userId = companyMoney.getUserId(); this.updateTime = companyMoney.getUpdateTime(); this.updateUserId = companyMoney.getUpdateUserId(); this.staff = companyMoney.getStaff(); this.complete = companyMoney.getComplete(); this.orderId = companyMoney.getOrderId(); this.actualReceipts = companyMoney.getActualReceipts(); this.balanceNow = companyMoney.getBalanceNow(); this.status = companyMoney.getStatus(); this.memo = companyMoney.getMemo(); this.deliveryTime = companyMoney.getDeliveryTime(); this.cstmrName = companyMoney.getCstmrName(); this.userName = companyMoney.getUserName(); this.receivablesType = companyMoney.getReceivablesType(); this.receivablesTypeName = companyMoney.getReceivablesTypeName(); } public CompanyMoney(String year, Double receivables, Date createTime, Long userId, Date updateTime, Long updateUserId, Long staff, String complete, Long orderId, Double actualReceipts) { this.year = year; this.receivables = receivables; src/main/java/com/zy/crm/manager/mapper/CompanyMoneyMapper.java
@@ -6,11 +6,15 @@ import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.util.List; @Mapper @Repository public interface CompanyMoneyMapper extends BaseMapper<CompanyMoney> { Double selectMoneyReceivablesAll(@Param("userId")Long userId, @Param("year")String year); Double selectMoneyActualReceiptsAll(@Param("userId")Long userId, @Param("year")String year); List<CompanyMoney> selectMoneyCopyAll(); void updateMoneyCopyByid(@Param("id")Long id); } src/main/java/com/zy/crm/manager/service/CompanyMoneyService.java
@@ -2,10 +2,15 @@ import com.baomidou.mybatisplus.service.IService; import com.zy.crm.manager.entity.CompanyMoney; import org.apache.ibatis.annotations.Param; import java.util.List; public interface CompanyMoneyService extends IService<CompanyMoney> { Double selectMoneyReceivablesAll(Long userId, String year); Double selectMoneyActualReceiptsAll(Long userId, String year); List<CompanyMoney> selectMoneyCopyAll(); void updateMoneyCopyByid(Long id); } src/main/java/com/zy/crm/manager/service/impl/CompanyMoneyServiceImpl.java
@@ -6,6 +6,8 @@ import com.zy.crm.manager.service.CompanyMoneyService; import org.springframework.stereotype.Service; import java.util.List; @Service("companyMoneyService") public class CompanyMoneyServiceImpl extends ServiceImpl<CompanyMoneyMapper, CompanyMoney> implements CompanyMoneyService { @@ -13,6 +15,10 @@ public Double selectMoneyReceivablesAll(Long userId, String year){return this.baseMapper.selectMoneyReceivablesAll(userId,year);} @Override public Double selectMoneyActualReceiptsAll(Long userId, String year){return this.baseMapper.selectMoneyActualReceiptsAll(userId,year);} @Override public List<CompanyMoney> selectMoneyCopyAll(){return this.baseMapper.selectMoneyCopyAll();} @Override public void updateMoneyCopyByid(Long id){this.baseMapper.updateMoneyCopyByid(id);} } src/main/java/com/zy/crm/manager/task/CstmrCopyScheduler.java
@@ -20,7 +20,7 @@ @Autowired private CstmrCopyHandler cstmrCopyHandler; // @Scheduled(cron = "0/3 * * * * ? ") @Scheduled(cron = "0/3 * * * * ? ") private void execute() { ReturnT<String> result = cstmrCopyHandler.start(); } src/main/java/com/zy/crm/manager/task/handler/CstmrCopyHandler.java
@@ -1,15 +1,20 @@ package com.zy.crm.manager.task.handler; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.core.common.Cools; import com.core.common.R; import com.core.exception.CoolException; import com.zy.crm.manager.controller.CstmrController; import com.zy.crm.manager.entity.CompanyMoney; import com.zy.crm.manager.entity.Cstmr; import com.zy.crm.manager.mapper.CstmrMapper; import com.zy.crm.manager.service.CompanyMoneyService; import com.zy.crm.manager.service.CstmrService; import com.zy.crm.manager.task.AbstractHandler; import com.zy.crm.manager.task.core.ReturnT; import com.zy.crm.manager.utils.TimeCalculatorUtils; import com.zy.crm.system.entity.User; import com.zy.crm.system.service.UserService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -35,6 +40,8 @@ private CstmrMapper cstmrMapper; @Autowired private CompanyMoneyService companyMoneyService; @Autowired private UserService userService; @Transactional @@ -56,8 +63,42 @@ } } if (true){ if (false){ List<CompanyMoney> companyMoneyList = companyMoneyService.selectMoneyCopyAll(); for (CompanyMoney companyMoney:companyMoneyList){ User user = userService.selectOne(new EntityWrapper<User>().eq("username", companyMoney.getUserName())); if (Cools.isEmpty(user)){ companyMoneyService.updateMoneyCopyByid(companyMoney.getId()); continue; } companyMoney.setUserId(user.getId()); companyMoney.setUpdateUserId(user.getId()); companyMoney.setReceivablesType(1); switch (companyMoney.getComplete()){ case "未结销": break; case "部分结销": companyMoney.setStatus(1); break; default: companyMoney.setStatus(2); } Cstmr cstmr = cstmrService.selectByName(1L, companyMoney.getCstmrName()); if (!Cools.isEmpty(cstmr)){ companyMoney.setCstmrId(cstmr.getId()); } CompanyMoney companyMoneyNew = new CompanyMoney(companyMoney); Date now = new Date(); companyMoneyNew.setUpdateTime(now); companyMoneyNew.setCreateTime(now); int yest = TimeCalculatorUtils.timeYest(companyMoney.getDeliveryTime()); companyMoneyNew.setYear(String.valueOf(yest)); companyMoneyService.insert(companyMoneyNew); companyMoneyService.updateMoneyCopyByid(companyMoney.getId()); } } src/main/resources/mapper/CompanyMoneyMapper.xml
@@ -15,6 +15,16 @@ <result column="complete" property="complete" /> <result column="order_id" property="orderId" /> <result column="actual_receipts" property="actualReceipts" /> <result column="balance_now" property="balanceNow" /> <result column="memo" property="memo" /> <result column="status" property="status" /> <result column="delivery_time" property="deliveryTime" /> <result column="cstmr_name" property="cstmrName" /> <result column="user_name" property="userName" /> <result column="receivables_type" property="receivablesType" /> <result column="receivables_type_name" property="receivablesTypeName" /> <result column="cstmr_id" property="cstmrId" /> <result column="status2" property="status2" /> </resultMap> @@ -30,4 +40,12 @@ and user_id = #{userId} </select> <select id="selectMoneyCopyAll" resultMap="BaseResultMap"> select * from man_company_money_copy where status2 is null </select> <update id="updateMoneyCopyByid"> update man_company_money_copy set status2 = 1 where id = #{id} </update> </mapper> src/main/webapp/views/cstmr/cstmr.html
@@ -174,6 +174,7 @@ <option value="制造业">制造业</option> <option value="纺织业">纺织业</option> <option value="仓储业">仓储业</option> <option value="农业">农业</option> </select> </div> </div>