|
@@ -1708,6 +1708,7 @@ public class DyoaHistoryServiceImpl implements IDyoaHistoryService{
|
|
|
if (StrUtil.isNotBlank(hisCommissionDeclare.getReportNO())){
|
|
|
List<MajorProduction> mps = majorProductionService.list(new LambdaQueryWrapper<MajorProduction>()
|
|
|
.select(BaseEntity::getId)
|
|
|
+ .eq(MajorProduction::getProduction,REPORT.name())
|
|
|
.eq(MajorProduction::getReportNo, hisCommissionDeclare.getReportNO()));
|
|
|
if (CollectionUtils.isNotEmpty(mps)){
|
|
|
mpId = mps.get(0).getId();
|
|
@@ -1724,14 +1725,14 @@ public class DyoaHistoryServiceImpl implements IDyoaHistoryService{
|
|
|
if (StrUtil.isNotBlank(pgFlowInstanceId)){
|
|
|
created = dyoaHistoryMapper.findCommissionDeclareDate(pgFlowInstanceId);
|
|
|
}
|
|
|
- CommissionDeclare pgCd = commissionDeclareService.getOne(new LambdaQueryWrapper<CommissionDeclare>()
|
|
|
+ List<CommissionDeclare> cds = commissionDeclareService.list(new LambdaQueryWrapper<CommissionDeclare>()
|
|
|
.eq(CommissionDeclare::getBusinessType, "COMMISSION_DECLARE_MAJOR_EVALUATE")
|
|
|
.eq(CommissionDeclare::getBusinessId, majorId)
|
|
|
.eq(mpId != null, CommissionDeclare::getProductionId, mpId)
|
|
|
.eq(CommissionDeclare::getDeclareUserId, pgUserId)
|
|
|
.eq(CommissionDeclare::getDeclareResult, "审核通过")
|
|
|
.eq(CommissionDeclare::getCommissionRateId, pgBusinessType1));
|
|
|
- if (pgCd==null ){
|
|
|
+ if (cds==null || cds.size()==0 ){
|
|
|
CommissionDeclare commissionDeclare = new CommissionDeclare();
|
|
|
commissionDeclare.setBusinessType("COMMISSION_DECLARE_MAJOR_EVALUATE");
|
|
|
commissionDeclare.setBusinessId(majorId);
|
|
@@ -1743,9 +1744,21 @@ public class DyoaHistoryServiceImpl implements IDyoaHistoryService{
|
|
|
commissionDeclareService.save(commissionDeclare);
|
|
|
pgcdId = commissionDeclare.getId();
|
|
|
}else{
|
|
|
- pgcdId = pgCd.getId();
|
|
|
- commissionDeclareService.update(new LambdaUpdateWrapper<CommissionDeclare>()
|
|
|
- .set(BaseEntity::getCreated,created==null?hisCommissionDeclare.getCreatedDatetime():created).eq(BaseEntity::getId,pgcdId));
|
|
|
+ if (cds.size()>1){
|
|
|
+ commissionDeclareService.delete(cds.get(0).getId());
|
|
|
+ pgcdId = cds.get(1).getId();
|
|
|
+ commissionDeclareService.update(new LambdaUpdateWrapper<CommissionDeclare>()
|
|
|
+ .set(BaseEntity::getCreated,created==null?hisCommissionDeclare.getCreatedDatetime():created)
|
|
|
+ .set(CommissionDeclare::getProductionId,mpId)
|
|
|
+ .eq(BaseEntity::getId,pgcdId));
|
|
|
+ }else{
|
|
|
+
|
|
|
+ pgcdId = cds.get(0).getId();
|
|
|
+ commissionDeclareService.update(new LambdaUpdateWrapper<CommissionDeclare>()
|
|
|
+ .set(BaseEntity::getCreated,created==null?hisCommissionDeclare.getCreatedDatetime():created)
|
|
|
+ .set(CommissionDeclare::getProductionId,mpId)
|
|
|
+ .eq(BaseEntity::getId,pgcdId));
|
|
|
+ }
|
|
|
}
|
|
|
//查询评估人员绩效比例
|
|
|
List<CommissionRate> rates = dyoaHistoryMapper.findPgRate(hisCommissionDeclare.getId());
|
|
@@ -1777,14 +1790,17 @@ public class DyoaHistoryServiceImpl implements IDyoaHistoryService{
|
|
|
if (StrUtil.isNotBlank(masterFlowInstanceId)){
|
|
|
created = dyoaHistoryMapper.findCommissionDeclareDate(masterFlowInstanceId);
|
|
|
}
|
|
|
- CommissionDeclare pgCd = commissionDeclareService.getOne(new LambdaQueryWrapper<CommissionDeclare>()
|
|
|
+ CommissionDeclare pgCd = null;
|
|
|
+ List<CommissionDeclare> pgCds = commissionDeclareService.list(new LambdaQueryWrapper<CommissionDeclare>()
|
|
|
.eq(CommissionDeclare::getBusinessType, "COMMISSION_DECLARE_MAJOR_MARKET")
|
|
|
.eq(CommissionDeclare::getBusinessId, majorId)
|
|
|
.eq(mpId != null, CommissionDeclare::getProductionId, mpId)
|
|
|
.eq(CommissionDeclare::getDeclareUserId, scUserId)
|
|
|
.eq(CommissionDeclare::getDeclareResult, "审核通过")
|
|
|
- .eq(CommissionDeclare::getCommissionRateId, scBusinessType1));
|
|
|
- if (pgCd==null){
|
|
|
+ .eq(CommissionDeclare::getCommissionRateId, scBusinessType1).orderByDesc(BaseEntity::getCreated))
|
|
|
+ ;
|
|
|
+
|
|
|
+ if (pgCds==null || pgCds.size()==0){
|
|
|
CommissionDeclare commissionDeclare = new CommissionDeclare();
|
|
|
commissionDeclare.setBusinessType("COMMISSION_DECLARE_MAJOR_MARKET");
|
|
|
commissionDeclare.setBusinessId(majorId);
|
|
@@ -1796,9 +1812,21 @@ public class DyoaHistoryServiceImpl implements IDyoaHistoryService{
|
|
|
commissionDeclareService.save(commissionDeclare);
|
|
|
sccdId = commissionDeclare.getId();
|
|
|
}else {
|
|
|
- sccdId = pgCd.getId();
|
|
|
- commissionDeclareService.update(new LambdaUpdateWrapper<CommissionDeclare>()
|
|
|
- .set(BaseEntity::getCreated,created==null?hisCommissionDeclare.getCreatedDatetime():created).eq(BaseEntity::getId,sccdId));
|
|
|
+ if (pgCds.size()>1){
|
|
|
+ commissionDeclareService.delete(pgCds.get(0).getId());
|
|
|
+ pgCd =pgCds.get(1);
|
|
|
+ sccdId = pgCd.getId();
|
|
|
+ commissionDeclareService.update(new LambdaUpdateWrapper<CommissionDeclare>()
|
|
|
+ .set(CommissionDeclare::getProductionId,mpId)
|
|
|
+ .set(BaseEntity::getCreated,created==null?hisCommissionDeclare.getCreatedDatetime():created).eq(BaseEntity::getId,sccdId));
|
|
|
+ }else{
|
|
|
+ pgCd =pgCds.get(0);
|
|
|
+ sccdId = pgCd.getId();
|
|
|
+ commissionDeclareService.update(new LambdaUpdateWrapper<CommissionDeclare>()
|
|
|
+ .set(CommissionDeclare::getProductionId,mpId)
|
|
|
+ .set(BaseEntity::getCreated,created==null?hisCommissionDeclare.getCreatedDatetime():created).eq(BaseEntity::getId,sccdId));
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
//查询市场人员绩效比例
|
|
|
List<CommissionRate> rates = dyoaHistoryMapper.findScRate(hisCommissionDeclare.getId());
|
|
@@ -1933,6 +1961,60 @@ public class DyoaHistoryServiceImpl implements IDyoaHistoryService{
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Boolean updateAssetsMembers() {
|
|
|
+ List<Assets> list = assetsService.getMembersIsNull();
|
|
|
+ for (Assets assets : list){
|
|
|
+ String dyoaId = dyoaRecordService.getMembersAndSignerInDyoa(assets.getId());
|
|
|
+ if (StrUtil.isNotBlank(dyoaId)){
|
|
|
+ List<Long> memberIds = new ArrayList<>();
|
|
|
+ Map<String,Object> members = dyoaHistoryMapper.getMembersAndSigner(dyoaId);
|
|
|
+ if (members==null){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Object o = members.get("members");
|
|
|
+ if (o!=null){
|
|
|
+ String mebStr = (String) o;
|
|
|
+ List<String> mList = Arrays.asList(mebStr.split(","));
|
|
|
+ for (String m : mList){
|
|
|
+ m = m.replaceAll(" ","");
|
|
|
+ Long mbsUserId = getMbsUserId(m);
|
|
|
+ if (!mbsUserId.equals(1L)){
|
|
|
+ memberIds.add(mbsUserId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ assets.setMembers(JSON.toJSONString(memberIds));
|
|
|
+
|
|
|
+ assetsService.updateMembers(assets);
|
|
|
+ List<Long> signs = new ArrayList<>();
|
|
|
+ Object o1 = members.get("signEmpName1");
|
|
|
+ if (o1!=null){
|
|
|
+ String s1 = (String) o1;
|
|
|
+ Long s1Id = getMbsUserId(s1);
|
|
|
+ if (!s1Id.equals(1L)){
|
|
|
+ signs.add(s1Id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Object o2 = members.get("signEmpName2");
|
|
|
+ if (o2!=null){
|
|
|
+ String s2 = (String) o2;
|
|
|
+ Long s2Id = getMbsUserId(s2);
|
|
|
+ if (!s2Id.equals(1L)){
|
|
|
+ signs.add(s2Id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Long> reportByAssetsId = assetsProductionService.getReportByAssetsId(assets.getId());
|
|
|
+ for (Long reportId : reportByAssetsId){
|
|
|
+ assetsProductionService.updateSigner(JSON.toJSONString(signs),reportId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public Boolean updateProductionFund() {
|