Commit 0c255e49 by huluobin

# 更新

parent e6a318f9
...@@ -10,7 +10,6 @@ import java.util.Date; ...@@ -10,7 +10,6 @@ import java.util.Date;
@Data @Data
public class ManageCostDto { public class ManageCostDto {
@JSONField(name = "detailname")
// 费用单号或采购单号 // 费用单号或采购单号
private String no; private String no;
...@@ -25,9 +24,9 @@ public class ManageCostDto { ...@@ -25,9 +24,9 @@ public class ManageCostDto {
// 理由/用途 // 理由/用途
private String reason; private String reason;
// 付款时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@JSONField(name = "cashier_time", format = "yyyy-MM-dd HH:mm:ss") @JSONField(name = "cashier_time", format = "yyyy-MM-dd HH:mm:ss")
// 付款时间
private Date payTime; private Date payTime;
// 费用付款单同cost_form=1,费用借还单同cost_form=3,采购单为0 // 费用付款单同cost_form=1,费用借还单同cost_form=3,采购单为0
...@@ -42,15 +41,12 @@ public class ManageCostDto { ...@@ -42,15 +41,12 @@ public class ManageCostDto {
private String feeSuperType; private String feeSuperType;
// 费用小类 // 费用小类
private String feeSubType; private String feeSubType;
// 金额 // 金额
private BigDecimal amount; private BigDecimal amount;
// 币种 // 币种
private String currency; private String currency;
// 人民币金额 // 人民币金额
private BigDecimal amountRmb; private BigDecimal amountRmb;
//费用单Id //费用单Id
private Integer costId; private Integer costId;
//费用单详情Id //费用单详情Id
......
...@@ -36,4 +36,6 @@ public interface CostTypeDao extends BaseMapper<CostTypeDomain> { ...@@ -36,4 +36,6 @@ public interface CostTypeDao extends BaseMapper<CostTypeDomain> {
// //
List<CostTypeDomain> selectTestType(); List<CostTypeDomain> selectTestType();
CostTypeDomain selectByTypeNameAndAccountSubjectName(@Param("typeName") String typeName, @Param("accountSubjectName") String accountSubjectName);
} }
...@@ -15,6 +15,7 @@ import com.blt.other.database.model.CostTypeDomain; ...@@ -15,6 +15,7 @@ import com.blt.other.database.model.CostTypeDomain;
import com.blt.other.database.model.UserDomain; import com.blt.other.database.model.UserDomain;
import com.blt.other.module.auth.dao.UserDao; import com.blt.other.module.auth.dao.UserDao;
import com.blt.other.module.cost.dao.*; import com.blt.other.module.cost.dao.*;
import com.blt.other.module.cost.model.AccountingSubject;
import com.blt.other.module.cost.model.CostDetailDomain; import com.blt.other.module.cost.model.CostDetailDomain;
import com.blt.other.module.cost.model.CostDomain; import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.CostApiService; import com.blt.other.module.cost.service.CostApiService;
...@@ -68,9 +69,15 @@ public class CostApiServiceImpl implements CostApiService { ...@@ -68,9 +69,15 @@ public class CostApiServiceImpl implements CostApiService {
costDomain.setCostStatus(0); costDomain.setCostStatus(0);
costDomain.setCostRemark(logisticsCostDto.getCostRemark() + "【WMS系统推送】"); costDomain.setCostRemark(logisticsCostDto.getCostRemark() + "【WMS系统推送】");
costDomain.setCostReason(logisticsCostDto.getCostReason()); costDomain.setCostReason(logisticsCostDto.getCostReason());
costDomain.setTypeId(5028);
// costDomain.setTypeNo("CTN1809180519188"); CostTypeDomain costTypeDomain = costTypeDao.selectByNameAndType("物流费", CostTypeDomain.feeType);
// costDomain.setTypeName("销售费用/物流费"); costDomain.setTypeId(costTypeDomain.getId());
costDomain.setTypeNo(costTypeDomain.getTypeNo());
costDomain.setTypeName(costTypeDomain.getTypeName());
AccountingSubject accountingSubject = accountingSubjectMapper.selectById(costTypeDomain.getAccountingSubjectId());
costDomain.setAccountingSubjectName(accountingSubject.getName());
costDomain.setAccountingSubjectNo(accountingSubject.getSubjectNo());
costDomain.setCompanyName("香港百伦科技有限公司"); costDomain.setCompanyName("香港百伦科技有限公司");
costDomain.setCompanyNo("COM1806191800013"); costDomain.setCompanyNo("COM1806191800013");
......
...@@ -174,7 +174,6 @@ public class OtherApplicationTests { ...@@ -174,7 +174,6 @@ public class OtherApplicationTests {
return getPrimaryDepartment(departmentMap, departmentMap.get(oaDepartment.getParentId())); return getPrimaryDepartment(departmentMap, departmentMap.get(oaDepartment.getParentId()));
} }
@Rollback(value = false) @Rollback(value = false)
@Test @Test
public void importMallProduct() { public void importMallProduct() {
...@@ -183,7 +182,6 @@ public class OtherApplicationTests { ...@@ -183,7 +182,6 @@ public class OtherApplicationTests {
} }
@Data @Data
public static class TypeItem { public static class TypeItem {
...@@ -203,7 +201,6 @@ public class OtherApplicationTests { ...@@ -203,7 +201,6 @@ public class OtherApplicationTests {
public static class TypeListener extends AnalysisEventListener<TypeItem> { public static class TypeListener extends AnalysisEventListener<TypeItem> {
private static final Logger LOGGER = LoggerFactory.getLogger(TypeListener.class); private static final Logger LOGGER = LoggerFactory.getLogger(TypeListener.class);
TypeListener() { TypeListener() {
...@@ -268,6 +265,69 @@ public class OtherApplicationTests { ...@@ -268,6 +265,69 @@ public class OtherApplicationTests {
} }
} }
@Rollback(value = false)
@Test
public void importCost() {
CostListener costListener = new CostListener();
EasyExcel.read("/Users/huluobin/Library/Containers/com.tencent.WeWorkMac/Data/Library/Application Support/WXWork/Data/1688853793439460/Cache/File/2021-01/1月份费用系统数据更新.xls", CostItem.class, costListener).sheet().doRead();
}
@Data
public static class CostItem {
@ExcelProperty("费用单号")
private String costNo;
@ExcelProperty("费用类别new")
private String typeName;
@ExcelProperty("会计科目new")
private String accountSubjectName;
}
public static class CostListener extends AnalysisEventListener<CostItem> {
private static final Logger LOGGER = LoggerFactory.getLogger(CostListener.class);
CostListener() {
}
private static final int BATCH_COUNT = 100;
List<CostItem> list = new ArrayList<>();
@Override
public void invoke(CostItem data, AnalysisContext context) {
LOGGER.info("解析到一条数据:{}", JSON.toJSONString(data));
list.add(data);
if (list.size() >= BATCH_COUNT) {
syncData();
list.clear();
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
syncData();
LOGGER.info("所有数据解析完成!");
}
private void syncData() {
list.forEach(item -> {
CostDao costDao = SpringContextUtil.getBean(CostDao.class);
CostTypeDao costTypeDao = SpringContextUtil.getBean(CostTypeDao.class);
CostDomain costDomain = costDao.selectByCostNo(item.getCostNo());
costDomain.setAccountingSubjectName(item.getAccountSubjectName());
costDomain.setTypeName(item.getTypeName());
CostTypeDomain costTypeDomain = costTypeDao.selectByTypeNameAndAccountSubjectName(item.getTypeName(), item.getAccountSubjectName());
costDao.updateById(costDomain);
});
}
}
@Resource @Resource
CostDao costDao; CostDao costDao;
@Resource @Resource
...@@ -381,7 +441,6 @@ public class OtherApplicationTests { ...@@ -381,7 +441,6 @@ public class OtherApplicationTests {
@Resource @Resource
IDepartmentReviewerService departmentReviewerService; IDepartmentReviewerService departmentReviewerService;
@Test @Test
@Rollback(value = false) @Rollback(value = false)
public void testOaDepartment() { public void testOaDepartment() {
...@@ -416,7 +475,7 @@ public class OtherApplicationTests { ...@@ -416,7 +475,7 @@ public class OtherApplicationTests {
req.setPageNum(1); req.setPageNum(1);
req.setPageSize(100); req.setPageSize(100);
List<DepartmentReviewerListItem> list = departmentReviewerService.departmentReviewerList(req).getRecords(); List<DepartmentReviewerListItem> list = departmentReviewerService.departmentReviewerList(req).getRecords();
list.forEach(item->item.setCostReviewerNames(item.getCostReviewerList().stream().map(CostReviewer::getReviewerUserName).collect(Collectors.joining(",")))); list.forEach(item -> item.setCostReviewerNames(item.getCostReviewerList().stream().map(CostReviewer::getReviewerUserName).collect(Collectors.joining(","))));
EasyExcel.write("/Users/huluobin/exportDepartmentReviewer.xlsx", DepartmentReviewerListItem.class).sheet("sheet").doWrite(list); EasyExcel.write("/Users/huluobin/exportDepartmentReviewer.xlsx", DepartmentReviewerListItem.class).sheet("sheet").doWrite(list);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment