Commit 8859729b by HlQ

[add]

1.收款记录添加导出功能以及删除收款记录,同步更新合同款项
2.项目列表添加工单数量
[chg]
1.上传文件,文件名后添加时间戳,更新为毫秒级
2.合同列表查询接口逻辑优化
3.文件上传限制上传100MB
1 parent e0388d33
...@@ -31,4 +31,4 @@ build/ ...@@ -31,4 +31,4 @@ build/
### VS Code ### ### VS Code ###
.vscode/ .vscode/
src/main/test/
\ No newline at end of file \ No newline at end of file
src/test/
\ No newline at end of file \ No newline at end of file
...@@ -60,7 +60,7 @@ public class FileController { ...@@ -60,7 +60,7 @@ public class FileController {
String orgName = infile.getOriginalFilename(); String orgName = infile.getOriginalFilename();
String mainName = FileUtil.mainName(orgName); String mainName = FileUtil.mainName(orgName);
String fileExt = FileUtil.extName(orgName); String fileExt = FileUtil.extName(orgName);
String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmss"), fileExt); String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS"), fileExt);
String path = getPath(fileInfo, filename); String path = getPath(fileInfo, filename);
File file = FileUtil.touch(path); File file = FileUtil.touch(path);
infile.transferTo(file); infile.transferTo(file);
...@@ -98,7 +98,7 @@ public class FileController { ...@@ -98,7 +98,7 @@ public class FileController {
String orgName = infile.getOriginalFilename(); String orgName = infile.getOriginalFilename();
String mainName = FileUtil.mainName(orgName); String mainName = FileUtil.mainName(orgName);
String fileExt = FileUtil.extName(orgName); String fileExt = FileUtil.extName(orgName);
String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmss"), fileExt); String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS"), fileExt);
String path = fileUrl + FileUtil.FILE_SEPARATOR + fileInfo.getStoreId() + FileUtil.FILE_SEPARATOR + fileInfo.getSourceId() + FileUtil.FILE_SEPARATOR + filename; String path = fileUrl + FileUtil.FILE_SEPARATOR + fileInfo.getStoreId() + FileUtil.FILE_SEPARATOR + fileInfo.getSourceId() + FileUtil.FILE_SEPARATOR + filename;
File file = FileUtil.touch(path); File file = FileUtil.touch(path);
infile.transferTo(file); infile.transferTo(file);
......
package vion.controller; package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.liaochong.myexcel.core.DefaultExcelBuilder;
import com.github.liaochong.myexcel.core.watermark.Watermark;
import com.github.liaochong.myexcel.utils.AttachmentExportUtil;
import com.github.liaochong.myexcel.utils.WatermarkUtil;
import io.github.linpeilie.Converter; import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import vion.dto.PaymentDTO; import vion.dto.PaymentDTO;
import vion.service.IPaymentService; import vion.service.IPaymentService;
import vion.vo.PaymentVO; import vion.vo.PaymentVO;
import vion.vo.UserVO;
import javax.servlet.http.HttpServletResponse;
import java.awt.*;
import java.io.IOException;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -42,8 +55,27 @@ public class PaymentController { ...@@ -42,8 +55,27 @@ public class PaymentController {
@DeleteMapping("/payment/{id}") @DeleteMapping("/payment/{id}")
@SaCheckPermission(value = "payment:remove", orRole = "admin") @SaCheckPermission(value = "payment:remove", orRole = "admin")
public String delById(@PathVariable Long id) { public String delById(@PathVariable Long id, String contractNo) {
return paymentService.removeById(id) ? "删除成功" : "删除失败"; return paymentService.delById(id, contractNo);
}
@GetMapping("/payment/export")
@SaCheckPermission(value = "contract:export", orRole = "admin")
public void pointExport(PaymentDTO dto, HttpServletResponse response) {
UserVO user = (UserVO) StpUtil.getTokenSession().get("curLoginUser");
dto.setPageSize(9999);
Page<PaymentVO> voPage = paymentService.list(dto);
try (DefaultExcelBuilder<PaymentVO> pointInfoVODefaultExcelBuilder = DefaultExcelBuilder.of(PaymentVO.class)) {
Workbook workbook = pointInfoVODefaultExcelBuilder.build(voPage.getRecords());
// 水印添加指定字体,并在服务器上安装 SimSun 字体,解决中文字体变成方块的问题
Watermark watermark = new Watermark();
watermark.setText(user.getUsername() + "-" + user.getPhone());
watermark.setFont(new Font("SimSun", Font.PLAIN, 16));
WatermarkUtil.addWatermark(workbook, watermark);
AttachmentExportUtil.export(workbook, StrUtil.format("收款列表_{}", DateUtil.formatDateTime(new Date())), response);
} catch (IOException e) {
throw new RuntimeException(e);
}
} }
} }
...@@ -40,7 +40,7 @@ public class TaskRunner { ...@@ -40,7 +40,7 @@ public class TaskRunner {
.map(l -> l.stream().map(Task::getActiveUser).collect(Collectors.toSet())) .map(l -> l.stream().map(Task::getActiveUser).collect(Collectors.toSet()))
.ifPresent(userIds -> { .ifPresent(userIds -> {
List<User> userList = userService.list(Wrappers.<User>lambdaQuery().in(User::getId, userIds)); List<User> userList = userService.list(Wrappers.<User>lambdaQuery().in(User::getId, userIds));
userList.forEach(user -> dingMod.sendMessage(buildMsg(user))); userList.forEach(user -> dingMod.workMsg(buildMsg(user)));
}); });
log.info("推送未完成工单完成"); log.info("推送未完成工单完成");
} }
......
...@@ -3,6 +3,7 @@ package vion.dto; ...@@ -3,6 +3,7 @@ package vion.dto;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
...@@ -41,4 +42,13 @@ public class PaymentDTO extends BaseDTO { ...@@ -41,4 +42,13 @@ public class PaymentDTO extends BaseDTO {
*/ */
private String remark; private String remark;
/**
* 收款开始时间、结束时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date collectionTimeStart;
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date collectionTimeEnd;
} }
\ No newline at end of file \ No newline at end of file
...@@ -109,6 +109,11 @@ public class PointInfoDTO extends BaseDTO { ...@@ -109,6 +109,11 @@ public class PointInfoDTO extends BaseDTO {
private Integer isInvoice; private Integer isInvoice;
/** /**
* 发票种类 1:增值税专用发票 2:增值税普通发票
*/
private Integer invoiceCategory;
/**
* 发票类型 1:电子发票 2:纸质发票 * 发票类型 1:电子发票 2:纸质发票
*/ */
private Integer invoiceType; private Integer invoiceType;
......
...@@ -27,6 +27,7 @@ public class InterceptorConfig implements WebMvcConfigurer { ...@@ -27,6 +27,7 @@ public class InterceptorConfig implements WebMvcConfigurer {
.excludePathPatterns("/api/point/frontSubmit") .excludePathPatterns("/api/point/frontSubmit")
.excludePathPatterns("/api/getQRCode", "/api/getFollowingOpenid", "/api/verifyScan") .excludePathPatterns("/api/getQRCode", "/api/getFollowingOpenid", "/api/verifyScan")
.excludePathPatterns("/api/point/getBindQRCode", "/api/point/getBindOpenid") .excludePathPatterns("/api/point/getBindQRCode", "/api/point/getBindOpenid")
.excludePathPatterns("/api/point/upd/{uuid}", "/api/point/get/{uuid}", "/api/point/install/submit/{uuid}", "/api/point/client/reject", "/api/point/reject/uuid/{uuid}"); .excludePathPatterns("/api/point/upd/{uuid}", "/api/point/get/{uuid}", "/api/point/install/submit/{uuid}", "/api/point/client/reject", "/api/point/reject/uuid/{uuid}")
.excludePathPatterns("/api/sparePart/frontSubmit");
} }
} }
...@@ -138,6 +138,12 @@ public class PointInfo { ...@@ -138,6 +138,12 @@ public class PointInfo {
private Integer invoiceType; private Integer invoiceType;
/** /**
* 发票种类 1:增值税专用发票 2:增值税普通发票
*/
@TableField(value = "invoice_category")
private Integer invoiceCategory;
/**
* 发票抬头 * 发票抬头
*/ */
@TableField(value = "invoice_header") @TableField(value = "invoice_header")
......
...@@ -14,4 +14,6 @@ public interface IPaymentService extends MPJBaseService<Payment> { ...@@ -14,4 +14,6 @@ public interface IPaymentService extends MPJBaseService<Payment> {
String save(List<PaymentDTO> dto); String save(List<PaymentDTO> dto);
String delById(Long id, String contractNo);
} }
...@@ -218,7 +218,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont ...@@ -218,7 +218,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
String orgName = infile.getOriginalFilename(); String orgName = infile.getOriginalFilename();
String mainName = FileUtil.mainName(orgName); String mainName = FileUtil.mainName(orgName);
String fileExt = FileUtil.extName(orgName); String fileExt = FileUtil.extName(orgName);
String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmss"), fileExt); String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS"), fileExt);
String path = fileUrl + FileUtil.FILE_SEPARATOR + "contract" + FileUtil.FILE_SEPARATOR + contract.getId() + FileUtil.FILE_SEPARATOR + filename; String path = fileUrl + FileUtil.FILE_SEPARATOR + "contract" + FileUtil.FILE_SEPARATOR + contract.getId() + FileUtil.FILE_SEPARATOR + filename;
File file = FileUtil.touch(path); File file = FileUtil.touch(path);
try { try {
...@@ -357,7 +357,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont ...@@ -357,7 +357,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
if (contractTeamService.save(rContractTeam)) { if (contractTeamService.save(rContractTeam)) {
// todo 推送钉钉消息到王平川,要支持可配置吗? // todo 推送钉钉消息到王平川,要支持可配置吗?
Contract contract = this.getById(dto.getContractId()); Contract contract = this.getById(dto.getContractId());
dingMod.sendMessage(buildMsg("01005444040832705136", contract, dto.getApplicantName())); dingMod.workMsg(buildMsg("01005444040832705136", contract, dto.getApplicantName()));
return "派工成功,待分配施工队。"; return "派工成功,待分配施工队。";
} }
return "派工失败"; return "派工失败";
...@@ -385,7 +385,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont ...@@ -385,7 +385,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
.select(RContractStore::getContractId), o -> Long.valueOf(o.toString())) .select(RContractStore::getContractId), o -> Long.valueOf(o.toString()))
: ListUtil.empty(); : ListUtil.empty();
// 根据产品线查出关联的合同 // 根据产品线查出关联的合同
List<Long> relatedContractIdList = Opt.ofNullable(dto.getProductLine()) List<Long> lineContractIdList = Opt.ofNullable(dto.getProductLine())
.map(pl -> Db.listObjs(Wrappers.lambdaQuery(Store.class).eq(Store::getProductLine, pl), Store::getId)) .map(pl -> Db.listObjs(Wrappers.lambdaQuery(Store.class).eq(Store::getProductLine, pl), Store::getId))
.map(storeIds -> contractStoreService.listObjs(Wrappers.<RContractStore>lambdaQuery().select(RContractStore::getContractId).in(RContractStore::getStoreId, storeIds), o -> Long.valueOf(o.toString()))) .map(storeIds -> contractStoreService.listObjs(Wrappers.<RContractStore>lambdaQuery().select(RContractStore::getContractId).in(RContractStore::getStoreId, storeIds), o -> Long.valueOf(o.toString())))
.orElse(new ArrayList<>()); .orElse(new ArrayList<>());
...@@ -395,25 +395,62 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont ...@@ -395,25 +395,62 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
.map(l -> l.stream().map(RoleVO::getCode).collect(Collectors.toSet())) .map(l -> l.stream().map(RoleVO::getCode).collect(Collectors.toSet()))
.orElse(CollUtil.newHashSet()); .orElse(CollUtil.newHashSet());
Assert.notEmpty(roleCodeList, "当前用户角色不详,请联系管理员"); Assert.notEmpty(roleCodeList, "当前用户角色不详,请联系管理员");
String saleName = ""; String curName;
if (!roleCodeList.contains("admin") && !roleCodeList.contains("shangwu") && !roleCodeList.contains("caiwu")) { if (!roleCodeList.contains("admin") && !roleCodeList.contains("shangwu") && !roleCodeList.contains("caiwu")) {
saleName = userVO.getUsername(); // 不是以上三个角色,只能访问自己相关的合同
curName = userVO.getUsername();
} else {
curName = "";
} }
// 查询当前销售关联的合同 // 根据查询条件的销售人查询关联的合同
List<Long> contractUserIdList = Opt.ofBlankAble(dto.getSaleName()) List<Long> contractUserIdList1 = Opt.ofBlankAble(dto.getSaleName())
.map(name -> contractUserService.listObjs(Wrappers.<RContractUser>lambdaQuery()
.select(RContractUser::getContractId).eq(RContractUser::getUsername, name), o -> Long.valueOf(o.toString())))
.orElse(new ArrayList<>());
// 根据查询条件的销售人查询其销售的合同
List<Long> contractUserIdList2 = Opt.ofBlankAble(dto.getSaleName())
.map(name -> this.listObjs(Wrappers.<Contract>lambdaQuery()
.select(Contract::getId).eq(Contract::getSaleName, name), o -> Long.valueOf(o.toString())))
.orElse(new ArrayList<>());
// 查询共同销售人为当前用户的关联合同
List<Long> contractUserIdList3 = Opt.ofBlankAble(curName)
.map(name -> contractUserService.listObjs(Wrappers.<RContractUser>lambdaQuery() .map(name -> contractUserService.listObjs(Wrappers.<RContractUser>lambdaQuery()
.select(RContractUser::getContractId).eq(RContractUser::getUsername, name), o -> Long.valueOf(o.toString()))) .select(RContractUser::getContractId).eq(RContractUser::getUsername, name), o -> Long.valueOf(o.toString())))
.orElse(new ArrayList<>()); .orElse(new ArrayList<>());
Set<Long> mergeContractIdList = new HashSet<>(CollUtil.addAll(relatedContractIdList, contractUserIdList)); // 查询合同销售人为当前用户的合同
List<Long> contractUserIdList4 = Opt.ofBlankAble(curName)
.map(name -> this.listObjs(Wrappers.<Contract>lambdaQuery()
.select(Contract::getId).eq(Contract::getSaleName, name), o -> Long.valueOf(o.toString())))
.orElse(new ArrayList<>());
Collection<Long> queryContractUserIdList = CollUtil.addAll(contractUserIdList1, contractUserIdList2);
Collection<Long> curContractUserIdList = CollUtil.addAll(contractUserIdList3, contractUserIdList4);
Set<Long> allContractUserIdList;
if (CollUtil.isNotEmpty(queryContractUserIdList) && CollUtil.isNotEmpty(curContractUserIdList)) {
// 当前用户和查询条件的销售人都存在,取交集
allContractUserIdList = CollUtil.intersectionDistinct(queryContractUserIdList, curContractUserIdList);
} else {
allContractUserIdList = CollUtil.unionDistinct(queryContractUserIdList, curContractUserIdList);
}
Set<Long> finalIdSet;
if (CollUtil.isNotEmpty(lineContractIdList) && CollUtil.isNotEmpty(allContractUserIdList)) {
// 产品线关联的合同和销售人或当前人关联的合同都存在,取交集
finalIdSet = CollUtil.intersectionDistinct(lineContractIdList, allContractUserIdList);
} else {
finalIdSet = CollUtil.unionDistinct(lineContractIdList, allContractUserIdList);
}
if (CollUtil.isEmpty(finalIdSet)) {
// 根据条件筛选要查询的合同为空,集合补元素 -1,防止数据库查询出错
finalIdSet.add(-1L);
}
// 前端传参中的 saleName 字段已单独处理,这里置空,不参与下一步的 converter.convert // 前端传参中的 saleName 字段已单独处理,这里置空,不参与下一步的 converter.convert
dto.setSaleName(null); dto.setSaleName(null);
MPJLambdaWrapper<Contract> wrapper = new MPJLambdaWrapper<>(converter.convert(dto, Contract.class)) MPJLambdaWrapper<Contract> wrapper = new MPJLambdaWrapper<>(converter.convert(dto, Contract.class))
.selectAll(Contract.class) .selectAll(Contract.class)
.eq(StrUtil.isNotBlank(saleName), Contract::getSaleName, saleName) .in(CollUtil.isNotEmpty(lineContractIdList) || CollUtil.isNotEmpty(allContractUserIdList), Contract::getId, finalIdSet)
.notIn(CollUtil.isNotEmpty(contractIdList), Contract::getId, contractIdList) .notIn(CollUtil.isNotEmpty(contractIdList), Contract::getId, contractIdList)
.in(CollUtil.isNotEmpty(mergeContractIdList), Contract::getId, mergeContractIdList)
.between(ArrayUtil.isAllNotNull(dto.getSignDateStart(), dto.getSignDateEnd()), Contract::getSignDate, dto.getSignDateStart(), dto.getSignDateEnd()) .between(ArrayUtil.isAllNotNull(dto.getSignDateStart(), dto.getSignDateEnd()), Contract::getSignDate, dto.getSignDateStart(), dto.getSignDateEnd())
.orderByDesc(Contract::getEntryTime); .orderByDesc(Contract::getEntryTime);
if (StrUtil.isNotBlank(dto.getOperator()) && ObjUtil.isNotNull(dto.getAmount())) { if (StrUtil.isNotBlank(dto.getOperator()) && ObjUtil.isNotNull(dto.getAmount())) {
......
...@@ -93,7 +93,7 @@ public class DeliveryRecordServiceImpl extends MPJBaseServiceImpl<DeliveryRecord ...@@ -93,7 +93,7 @@ public class DeliveryRecordServiceImpl extends MPJBaseServiceImpl<DeliveryRecord
public String saveBatch(List<DeliveryRecordDTO> dto) { public String saveBatch(List<DeliveryRecordDTO> dto) {
List<DeliveryRecord> records = converter.convert(dto, DeliveryRecord.class); List<DeliveryRecord> records = converter.convert(dto, DeliveryRecord.class);
if (this.saveBatch(records)) { if (this.saveBatch(records)) {
records.forEach(record -> updStatusAndPushMsg(record)); records.forEach(this::updStatusAndPushMsg);
return "新增成功"; return "新增成功";
} else { } else {
return "新增失败"; return "新增失败";
...@@ -141,7 +141,7 @@ public class DeliveryRecordServiceImpl extends MPJBaseServiceImpl<DeliveryRecord ...@@ -141,7 +141,7 @@ public class DeliveryRecordServiceImpl extends MPJBaseServiceImpl<DeliveryRecord
Opt.ofNullable(((User) redisTemplate.opsForValue().get("dingtalk:user:name:" + existContract.getSaleName()))) Opt.ofNullable(((User) redisTemplate.opsForValue().get("dingtalk:user:name:" + existContract.getSaleName())))
.map(User::getUserid) .map(User::getUserid)
.ifPresent(useridList::add); .ifPresent(useridList::add);
dingMod.sendMessage(buildMsg(useridList.stream().distinct().collect(Collectors.joining(",")), record, existContract)); dingMod.workMsg(buildMsg(useridList.stream().distinct().collect(Collectors.joining(",")), record, existContract));
} }
JSONObject buildMsg(String userid, DeliveryRecord rec, Contract contract) { JSONObject buildMsg(String userid, DeliveryRecord rec, Contract contract) {
...@@ -178,7 +178,7 @@ public class DeliveryRecordServiceImpl extends MPJBaseServiceImpl<DeliveryRecord ...@@ -178,7 +178,7 @@ public class DeliveryRecordServiceImpl extends MPJBaseServiceImpl<DeliveryRecord
String orgName = infile.getOriginalFilename(); String orgName = infile.getOriginalFilename();
String mainName = FileUtil.mainName(orgName); String mainName = FileUtil.mainName(orgName);
String fileExt = FileUtil.extName(orgName); String fileExt = FileUtil.extName(orgName);
String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmss"), fileExt); String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS"), fileExt);
String path = fileUrl + FileUtil.FILE_SEPARATOR + "delivery" + FileUtil.FILE_SEPARATOR + deliveryRecord.getContractId() + FileUtil.FILE_SEPARATOR + deliveryRecord.getId() + FileUtil.FILE_SEPARATOR + filename; String path = fileUrl + FileUtil.FILE_SEPARATOR + "delivery" + FileUtil.FILE_SEPARATOR + deliveryRecord.getContractId() + FileUtil.FILE_SEPARATOR + deliveryRecord.getId() + FileUtil.FILE_SEPARATOR + filename;
File file = FileUtil.touch(path); File file = FileUtil.touch(path);
try { try {
......
package vion.service.impl; package vion.service.impl;
import cn.dev33.satoken.stp.StpUtil; import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.lang.Opt; import cn.hutool.core.lang.Opt;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjUtil; import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -23,6 +26,7 @@ import vion.vo.RoleVO; ...@@ -23,6 +26,7 @@ import vion.vo.RoleVO;
import vion.vo.UserVO; import vion.vo.UserVO;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -56,6 +60,7 @@ public class PaymentServiceImpl extends MPJBaseServiceImpl<PaymentMapper, Paymen ...@@ -56,6 +60,7 @@ public class PaymentServiceImpl extends MPJBaseServiceImpl<PaymentMapper, Paymen
.selectAll(Payment.class) .selectAll(Payment.class)
.leftJoin(Contract.class, Contract::getContractNo, Payment::getContractNo) .leftJoin(Contract.class, Contract::getContractNo, Payment::getContractNo)
.eq(StrUtil.isNotBlank(saleName), Contract::getSaleName, saleName) .eq(StrUtil.isNotBlank(saleName), Contract::getSaleName, saleName)
.between(ArrayUtil.isAllNotNull(dto.getCollectionTimeStart(), dto.getCollectionTimeEnd()), Payment::getCollectionTime, dto.getCollectionTimeStart(), dto.getCollectionTimeEnd())
.orderByDesc(Payment::getCreateTime); .orderByDesc(Payment::getCreateTime);
return this.selectJoinListPage(Page.of(dto.getPageNum(), dto.getPageSize()), PaymentVO.class, wrapper); return this.selectJoinListPage(Page.of(dto.getPageNum(), dto.getPageSize()), PaymentVO.class, wrapper);
} }
...@@ -73,11 +78,20 @@ public class PaymentServiceImpl extends MPJBaseServiceImpl<PaymentMapper, Paymen ...@@ -73,11 +78,20 @@ public class PaymentServiceImpl extends MPJBaseServiceImpl<PaymentMapper, Paymen
this.updateById(p); this.updateById(p);
} }
}); });
Map<String, List<Payment>> no2PaymentMap = paymentList.stream().collect(Collectors.groupingBy(Payment::getContractNo)); List<String> noList = paymentList.stream().map(Payment::getContractNo).collect(Collectors.toList());
Map<String, List<Payment>> no2PaymentMap = this.lambdaQuery()
.in(Payment::getContractNo, noList)
.list()
.stream().collect(Collectors.groupingBy(Payment::getContractNo));
List<String> failList = new ArrayList<>();
no2PaymentMap.forEach((no, list) -> { no2PaymentMap.forEach((no, list) -> {
BigDecimal sumAmount = list.stream().map(Payment::getPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal sumAmount = list.stream().map(Payment::getPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
Contract existContract = contractService.lambdaQuery().eq(Contract::getContractNo, no).one(); Contract existContract = contractService.lambdaQuery().eq(Contract::getContractNo, no).one();
if (ObjUtil.isNull(existContract)) {
failList.add(no);
return;
}
// 最新的应收款去计算 // 最新的应收款去计算
Contract updDto = new Contract(); Contract updDto = new Contract();
updDto.setId(existContract.getId()); updDto.setId(existContract.getId());
...@@ -85,6 +99,27 @@ public class PaymentServiceImpl extends MPJBaseServiceImpl<PaymentMapper, Paymen ...@@ -85,6 +99,27 @@ public class PaymentServiceImpl extends MPJBaseServiceImpl<PaymentMapper, Paymen
contractPaymentService.calMoney(existContract, updDto); contractPaymentService.calMoney(existContract, updDto);
contractService.updateById(updDto); contractService.updateById(updDto);
}); });
if (CollUtil.isNotEmpty(failList)) {
return StrUtil.format("合同编号为{}的合同不存在", failList.toString());
}
return "成功"; return "成功";
} }
@Override
@Transactional(rollbackFor = Exception.class)
public String delById(Long id, String contractNo) {
Contract existContract = contractService.lambdaQuery().eq(Contract::getContractNo, contractNo).one();
Assert.notNull(existContract, "该合同编号对应的合同不存在");
this.removeById(id);
// 最新的应收款去计算
BigDecimal sumAmount = this.lambdaQuery().eq(Payment::getContractNo, contractNo).list()
.stream().map(Payment::getPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
Contract updDto = new Contract();
updDto.setId(existContract.getId());
updDto.setPaidAmount(sumAmount);
contractPaymentService.calMoney(existContract, updDto);
contractService.updateById(updDto);
return "删除成功";
}
} }
...@@ -66,7 +66,7 @@ public class PointInfoServiceImpl extends MPJBaseServiceImpl<PointInfoMapper, Po ...@@ -66,7 +66,7 @@ public class PointInfoServiceImpl extends MPJBaseServiceImpl<PointInfoMapper, Po
@Value("${fileUrl:}") @Value("${fileUrl:}")
private String fileUrl; private String fileUrl;
private final static String DING_GROUP_TOKEN = "7570806785271d2b0a766e0172f49620cf04223bf89077f5b676b7d7a4124373"; private final static String DING_GROUP_TOKEN = "未定";
@Override @Override
public Object frontSubmit(PointInfoDTO dto) { public Object frontSubmit(PointInfoDTO dto) {
...@@ -213,7 +213,7 @@ public class PointInfoServiceImpl extends MPJBaseServiceImpl<PointInfoMapper, Po ...@@ -213,7 +213,7 @@ public class PointInfoServiceImpl extends MPJBaseServiceImpl<PointInfoMapper, Po
String orgName = infile.getOriginalFilename(); String orgName = infile.getOriginalFilename();
String mainName = FileUtil.mainName(orgName); String mainName = FileUtil.mainName(orgName);
String fileExt = FileUtil.extName(orgName); String fileExt = FileUtil.extName(orgName);
String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmss"), fileExt); String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS"), fileExt);
String path = getPath(id, dto, filename); String path = getPath(id, dto, filename);
File file = FileUtil.touch(path); File file = FileUtil.touch(path);
try { try {
......
...@@ -124,7 +124,7 @@ public class SettlementDiffServiceImpl extends MPJBaseServiceImpl<SettlementDiff ...@@ -124,7 +124,7 @@ public class SettlementDiffServiceImpl extends MPJBaseServiceImpl<SettlementDiff
String orgName = infile.getOriginalFilename(); String orgName = infile.getOriginalFilename();
String mainName = FileUtil.mainName(orgName); String mainName = FileUtil.mainName(orgName);
String fileExt = FileUtil.extName(orgName); String fileExt = FileUtil.extName(orgName);
String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmss"), fileExt); String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS"), fileExt);
String path = fileUrl + FileUtil.FILE_SEPARATOR + "settlementDiff" + FileUtil.FILE_SEPARATOR + dto.getContractNo() + FileUtil.FILE_SEPARATOR + filename; String path = fileUrl + FileUtil.FILE_SEPARATOR + "settlementDiff" + FileUtil.FILE_SEPARATOR + dto.getContractNo() + FileUtil.FILE_SEPARATOR + filename;
File file = FileUtil.touch(path); File file = FileUtil.touch(path);
try { try {
......
...@@ -106,6 +106,7 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp ...@@ -106,6 +106,7 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
storeVO.setContractCount(Opt.ofEmptyAble(contractStores).map(List::size).orElse(0)); storeVO.setContractCount(Opt.ofEmptyAble(contractStores).map(List::size).orElse(0));
Contract masterContract = id2ContractMap.getOrDefault(item.getMasterContract(), null); Contract masterContract = id2ContractMap.getOrDefault(item.getMasterContract(), null);
storeVO.setMainContract(Opt.ofNullable(masterContract).map(c -> converter.convert(c, ContractVO.class)).orElse(null)); storeVO.setMainContract(Opt.ofNullable(masterContract).map(c -> converter.convert(c, ContractVO.class)).orElse(null));
storeVO.setTaskCount(store2TaskIdMap.getOrDefault(storeId, ListUtil.empty()).size());
// 补充服务单 // 补充服务单
if (store2TaskIdMap.containsKey(item.getId())) { if (store2TaskIdMap.containsKey(item.getId())) {
...@@ -132,7 +133,7 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp ...@@ -132,7 +133,7 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
String orgName = infile.getOriginalFilename(); String orgName = infile.getOriginalFilename();
String mainName = FileUtil.mainName(orgName); String mainName = FileUtil.mainName(orgName);
String fileExt = FileUtil.extName(orgName); String fileExt = FileUtil.extName(orgName);
String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmss"), fileExt); String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS"), fileExt);
String path = fileUrl + FileUtil.FILE_SEPARATOR + statusDTO.getStoreId() + FileUtil.FILE_SEPARATOR + statusDTO.getSourceId() + FileUtil.FILE_SEPARATOR + filename; String path = fileUrl + FileUtil.FILE_SEPARATOR + statusDTO.getStoreId() + FileUtil.FILE_SEPARATOR + statusDTO.getSourceId() + FileUtil.FILE_SEPARATOR + filename;
File file = FileUtil.touch(path); File file = FileUtil.touch(path);
try { try {
......
...@@ -287,7 +287,7 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem ...@@ -287,7 +287,7 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem
.ifPresent(useridList::add); .ifPresent(useridList::add);
} }
JSONObject msg = buildMsg(String.join(",", useridList), store.getName(), existTask); JSONObject msg = buildMsg(String.join(",", useridList), store.getName(), existTask);
String pushRes = dingMod.sendMessage(msg); String pushRes = dingMod.workMsg(msg);
// todo 异步微信公众号消息推送 // todo 异步微信公众号消息推送
if (task.getStatus() == 3) { if (task.getStatus() == 3) {
...@@ -325,7 +325,7 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem ...@@ -325,7 +325,7 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem
String orgName = infile.getOriginalFilename(); String orgName = infile.getOriginalFilename();
String mainName = FileUtil.mainName(orgName); String mainName = FileUtil.mainName(orgName);
String fileExt = FileUtil.extName(orgName); String fileExt = FileUtil.extName(orgName);
String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmss"), fileExt); String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS"), fileExt);
String path = fileUrl + FileUtil.FILE_SEPARATOR + data.getStoreId() + FileUtil.FILE_SEPARATOR + task.getId() + FileUtil.FILE_SEPARATOR + filename; String path = fileUrl + FileUtil.FILE_SEPARATOR + data.getStoreId() + FileUtil.FILE_SEPARATOR + task.getId() + FileUtil.FILE_SEPARATOR + filename;
File file = FileUtil.touch(path); File file = FileUtil.touch(path);
try { try {
......
...@@ -87,7 +87,7 @@ public class TaskTempServiceImpl extends MPJBaseServiceImpl<TaskTempMapper, Task ...@@ -87,7 +87,7 @@ public class TaskTempServiceImpl extends MPJBaseServiceImpl<TaskTempMapper, Task
String orgName = infile.getOriginalFilename(); String orgName = infile.getOriginalFilename();
String mainName = FileUtil.mainName(orgName); String mainName = FileUtil.mainName(orgName);
String fileExt = FileUtil.extName(orgName); String fileExt = FileUtil.extName(orgName);
String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmss"), fileExt); String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS"), fileExt);
String path = fileUrl + FileUtil.FILE_SEPARATOR + 0 + FileUtil.FILE_SEPARATOR + taskTemp.getId() + FileUtil.FILE_SEPARATOR + filename; String path = fileUrl + FileUtil.FILE_SEPARATOR + 0 + FileUtil.FILE_SEPARATOR + taskTemp.getId() + FileUtil.FILE_SEPARATOR + filename;
File file = FileUtil.touch(path); File file = FileUtil.touch(path);
try { try {
...@@ -111,7 +111,7 @@ public class TaskTempServiceImpl extends MPJBaseServiceImpl<TaskTempMapper, Task ...@@ -111,7 +111,7 @@ public class TaskTempServiceImpl extends MPJBaseServiceImpl<TaskTempMapper, Task
// todo 异步发送钉钉消息通知 // todo 异步发送钉钉消息通知
List<User> userList = userService.lambdaQuery().eq(User::getPreWorkOrder, 1).list(); List<User> userList = userService.lambdaQuery().eq(User::getPreWorkOrder, 1).list();
String userids = userList.stream().map(User::getUserid).collect(Collectors.joining(",")); String userids = userList.stream().map(User::getUserid).collect(Collectors.joining(","));
dingMod.sendMessage(buildMsg(userids, taskTemp)); dingMod.workMsg(buildMsg(userids, taskTemp));
return MapUtil.<String, Long>builder() return MapUtil.<String, Long>builder()
.put("id", taskTemp.getId()) .put("id", taskTemp.getId())
......
...@@ -187,9 +187,9 @@ public class DingMod { ...@@ -187,9 +187,9 @@ public class DingMod {
} }
/** /**
* 钉钉消息推送 * 钉钉工作消息推送
*/ */
public String sendMessage(JSONObject msg) { public String workMsg(JSONObject msg) {
String token = getToken(); String token = getToken();
String res = HttpUtil.post("https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2?access_token=" + token, msg.toString()); String res = HttpUtil.post("https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2?access_token=" + token, msg.toString());
log.info("钉钉工作通知消息推送:{}", res); log.info("钉钉工作通知消息推送:{}", res);
......
package vion.vo; package vion.vo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.github.liaochong.myexcel.core.annotation.ExcelColumn;
import com.github.liaochong.myexcel.core.annotation.ExcelModel;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
...@@ -9,33 +11,39 @@ import java.util.Date; ...@@ -9,33 +11,39 @@ import java.util.Date;
@Getter @Getter
@Setter @Setter
@ExcelModel(sheetName = "收款列表", includeAllField = false)
public class PaymentVO { public class PaymentVO {
private Long id; private Long id;
/** /**
* 合同编号 * 合同编号
*/ */
@ExcelColumn(order = 0, title = "合同编号")
private String contractNo; private String contractNo;
/** /**
* 流水号 * 流水号
*/ */
@ExcelColumn(order = 1, title = "流水号")
private String serialNo; private String serialNo;
/** /**
* 收款时间 * 收款时间
*/ */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@ExcelColumn(order = 2, title = "收款时间", format = "yyyy-MM-dd")
private Date collectionTime; private Date collectionTime;
/** /**
* 收款金额 * 收款金额
*/ */
@ExcelColumn(order = 3, title = "收款金额")
private BigDecimal paymentAmount; private BigDecimal paymentAmount;
/** /**
* 备注 * 备注
*/ */
@ExcelColumn(order = 4, title = "备注")
private String remark; private String remark;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
......
...@@ -135,6 +135,11 @@ public class PointInfoVO { ...@@ -135,6 +135,11 @@ public class PointInfoVO {
private Integer invoiceType; private Integer invoiceType;
/** /**
* 发票种类 1:增值税专用发票 2:增值税普通发票
*/
private Integer invoiceCategory;
/**
* 发票抬头 * 发票抬头
*/ */
private String invoiceHeader; private String invoiceHeader;
......
...@@ -70,5 +70,10 @@ public class StoreVO { ...@@ -70,5 +70,10 @@ public class StoreVO {
*/ */
private Integer serviceOrderCount; private Integer serviceOrderCount;
/**
* 工单数量
*/
private Integer taskCount;
private ContractVO mainContract; private ContractVO mainContract;
} }
...@@ -5,8 +5,8 @@ spring: ...@@ -5,8 +5,8 @@ spring:
driver-class-name: org.postgresql.Driver driver-class-name: org.postgresql.Driver
servlet: servlet:
multipart: multipart:
max-file-size: 10MB max-file-size: 100MB
max-request-size: 10MB max-request-size: 100MB
mvc: mvc:
view: view:
prefix: / prefix: /
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!