|
@@ -83,6 +83,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
|
try {
|
|
|
String token = request.getHeader("token");
|
|
|
User user = userMapper.selectById(token);
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
|
|
|
List<SysRichFunction> functionContractList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看全部合同");
|
|
|
if(functionContractList.size() <= 0){
|
|
|
httpRespMsg.setError(MessageUtils.message("access.viewError"));
|
|
@@ -111,6 +112,11 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
|
}
|
|
|
List<Contract> contracts = contractMapper.selectContract(user.getCompanyId(), pageStart, pageSize, number, name , typeName , status, startDate,endDate);
|
|
|
List<Contract> total = contractMapper.selectContract(user.getCompanyId(), null, null, number, name, typeName, status, startDate, endDate);
|
|
|
+ for (Contract contract : contracts) {
|
|
|
+ if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
+ contract.setCreatorName(contract.getCreatorWxCorpId());
|
|
|
+ }
|
|
|
+ }
|
|
|
//首先获取所有合同的Id
|
|
|
List<Integer> contractCollect = contracts.stream().map(c -> c.getId()).collect(Collectors.toList());
|
|
|
contractCollect.add(-1);
|
|
@@ -120,7 +126,6 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
|
List<String> userCollect = fileList.stream().map(c -> c.getCreatorId()).distinct().collect(Collectors.toList());
|
|
|
userCollect.add("-1");
|
|
|
List<User> userList = userMapper.selectList(new QueryWrapper<User>().in("id", userCollect));
|
|
|
- WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
|
|
|
for (ContractDocument contractDocument : fileList) {
|
|
|
if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
for (User item : userList) {
|
|
@@ -138,6 +143,10 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
|
contractPageVO.setId(contract.getId());
|
|
|
contractPageVO.setCompanyId(contract.getCompanyId());
|
|
|
contractPageVO.setCreatorId(contract.getCreatorId());
|
|
|
+ contractPageVO.setCreatorName(contract.getCreatorName());
|
|
|
+ contractPageVO.setCreatorWxCorpId(contract.getCreatorWxCorpId());
|
|
|
+ contractPageVO.setStartDate(contract.getStartDate());
|
|
|
+ contractPageVO.setEndDate(contract.getEndDate());
|
|
|
contractPageVO.setIndate(contract.getIndate());
|
|
|
contractPageVO.setNumber(contract.getNumber());
|
|
|
contractPageVO.setName(contract.getName());
|
|
@@ -195,6 +204,9 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
|
List<String> headList = new ArrayList<String>();
|
|
|
// headList.add("合同编号");
|
|
|
// headList.add("合同名称");
|
|
|
+// headList.add("合同开始时间");
|
|
|
+// headList.add("合同结束时间");
|
|
|
+// headList.add("合同创建者");
|
|
|
// headList.add("合同金额(¥)");
|
|
|
// headList.add("合同类型");
|
|
|
// headList.add("状态");
|
|
@@ -202,6 +214,9 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
|
// headList.add("备注");
|
|
|
headList.add(MessageUtils.message("entry.contractNo"));
|
|
|
headList.add(MessageUtils.message("contract.name"));
|
|
|
+ headList.add(MessageUtils.message("Contract.startDate"));
|
|
|
+ headList.add(MessageUtils.message("Contract.endDate"));
|
|
|
+ headList.add(MessageUtils.message("Contract.creatorName"));
|
|
|
headList.add(MessageUtils.message("entry.contract"));
|
|
|
headList.add(MessageUtils.message("contract.type"));
|
|
|
headList.add(MessageUtils.message("leave.status"));
|
|
@@ -213,6 +228,14 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
|
ArrayList<String> item = new ArrayList<>();
|
|
|
item.add(contract.getNumber()==null?"":contract.getNumber());
|
|
|
item.add(contract.getName());
|
|
|
+ item.add(contract.getStartDate()==null?"":contract.getStartDate()+"");
|
|
|
+ item.add(contract.getEndDate()==null?"":contract.getEndDate()+"");
|
|
|
+ if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
+ contract.setCreatorName("$userName=" + contract.getCreatorWxCorpId() + "$");
|
|
|
+ }else {
|
|
|
+ contract.setCreatorName(contract.getCreatorName());
|
|
|
+ }
|
|
|
+ item.add(contract.getCreatorName());
|
|
|
item.add(contract.getAmounts()==null?"":contract.getAmounts().toString() + "元");
|
|
|
item.add(contract.getTypeName());
|
|
|
switch (contract.getStatus()){
|
|
@@ -229,7 +252,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
|
item.add("导入待审核");
|
|
|
break;
|
|
|
default:
|
|
|
- item.add("");
|
|
|
+ item.add("_");
|
|
|
}
|
|
|
item.add(contract.getIndate().toString());
|
|
|
item.add(contract.getRemarks()==null?"":contract.getRemarks());
|
|
@@ -279,10 +302,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
|
httpRespMsg.msg = MessageUtils.message("Contract.amountNegative");
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
- //若日期为空,则写入当前日期
|
|
|
- if (contract.getIndate() == null){
|
|
|
- contract.setIndate(LocalDate.now());
|
|
|
- }
|
|
|
+ contract.setIndate(LocalDate.now());
|
|
|
contract.setCreatorId(user.getId());
|
|
|
contract.setCompanyId(user.getCompanyId());
|
|
|
contractMapper.insert(contract);
|
|
@@ -325,6 +345,8 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
}
|
|
|
+ contract.setStatus(1);
|
|
|
+ contract.setIndate(null);
|
|
|
contractMapper.updateById(contract);
|
|
|
httpRespMsg.msg = MessageUtils.message("contract.editSuc");
|
|
|
return httpRespMsg;
|
|
@@ -370,9 +392,6 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
|
outputStream.close();
|
|
|
//然后解析表格
|
|
|
Workbook workbook = WorkbookFactory.create(new FileInputStream(file));
|
|
|
- //时间格式
|
|
|
- DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/M/d");
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy/M/d");
|
|
|
Sheet sheet = workbook.getSheetAt(0);
|
|
|
int rowNum = sheet.getLastRowNum();
|
|
|
if (rowNum == 0) {
|
|
@@ -396,7 +415,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
|
}
|
|
|
boolean NoExists = false;
|
|
|
boolean TypeExists = false;
|
|
|
- for (int i = 0; i < 5; i++) {
|
|
|
+ for (int i = 0; i < 7; i++) {
|
|
|
if (row.getCell(i) != null) {
|
|
|
row.getCell(i).setCellType(CellType.STRING);
|
|
|
}
|
|
@@ -408,9 +427,11 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
|
}
|
|
|
String No = row.getCell(0)==null?null:row.getCell(0).getStringCellValue();
|
|
|
String name = row.getCell(1)==null?null:row.getCell(1).getStringCellValue();
|
|
|
- String amounts = row.getCell(2)==null?null:row.getCell(2).getStringCellValue();
|
|
|
- String type = row.getCell(3)==null?null:row.getCell(3).getStringCellValue();
|
|
|
- String remarks = row.getCell(4)==null?null:row.getCell(4).getStringCellValue();
|
|
|
+ String startDate = row.getCell(2)==null?null:row.getCell(2).getStringCellValue();
|
|
|
+ String endDate = row.getCell(3)==null?null:row.getCell(3).getStringCellValue();
|
|
|
+ String amounts = row.getCell(4)==null?null:row.getCell(4).getStringCellValue();
|
|
|
+ String type = row.getCell(5)==null?null:row.getCell(5).getStringCellValue();
|
|
|
+ String remarks = row.getCell(6)==null?null:row.getCell(6).getStringCellValue();
|
|
|
Contract item = new Contract();
|
|
|
//检查合同编号是否存在
|
|
|
if (StringUtils.isNotBlank(No)){
|
|
@@ -456,7 +477,17 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
|
item.setCreatorId(user.getId());
|
|
|
item.setIndate(LocalDate.now());
|
|
|
item.setStatus(3);
|
|
|
- if (Double.parseDouble(amounts) <= 0 ){
|
|
|
+ //时间转化
|
|
|
+ DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-M-d");
|
|
|
+ if (StringUtils.isNotBlank(startDate)){
|
|
|
+ LocalDate start = LocalDate.parse(startDate, dtf);
|
|
|
+ item.setStartDate(start);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(endDate)){
|
|
|
+ LocalDate end = LocalDate.parse(endDate, dtf);
|
|
|
+ item.setEndDate(end);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(amounts) && Double.parseDouble(amounts) <= 0 ){
|
|
|
//第{0}行金额不可为负数
|
|
|
msg.setError(MessageUtils.message("Contract.amountNegativeByCell",dataIndex));
|
|
|
return msg;
|