Showing
7 changed files
with
438 additions
and
152 deletions
| 1 | package com.lframework.xingyun.sc.bo.customer.credit; | 1 | package com.lframework.xingyun.sc.bo.customer.credit; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | +import com.lframework.xingyun.sc.entity.CorePersonnelHistory; | ||
| 5 | + | ||
| 4 | import java.util.List; | 6 | import java.util.List; |
| 5 | 7 | ||
| 6 | /** | 8 | /** |
| @@ -9,6 +11,16 @@ import java.util.List; | @@ -9,6 +11,16 @@ import java.util.List; | ||
| 9 | public class ChangeData { | 11 | public class ChangeData { |
| 10 | private List<ChangeItem> otherChangeList; | 12 | private List<ChangeItem> otherChangeList; |
| 11 | 13 | ||
| 14 | + /** | ||
| 15 | + * 核心人员变更前 | ||
| 16 | + */ | ||
| 17 | + private List<CorePersonnelHistory> personnelBeforeChangeList; | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * 核心人员变更后 | ||
| 21 | + */ | ||
| 22 | + private List<CorePersonnelHistory> personnelAfterChangeList; | ||
| 23 | + | ||
| 12 | public List<ChangeItem> getOtherChangeList() { | 24 | public List<ChangeItem> getOtherChangeList() { |
| 13 | return otherChangeList; | 25 | return otherChangeList; |
| 14 | } | 26 | } |
| @@ -16,4 +28,20 @@ public class ChangeData { | @@ -16,4 +28,20 @@ public class ChangeData { | ||
| 16 | public void setOtherChangeList(List<ChangeItem> otherChangeList) { | 28 | public void setOtherChangeList(List<ChangeItem> otherChangeList) { |
| 17 | this.otherChangeList = otherChangeList; | 29 | this.otherChangeList = otherChangeList; |
| 18 | } | 30 | } |
| 31 | + | ||
| 32 | + public List<CorePersonnelHistory> getPersonnelBeforeChangeList() { | ||
| 33 | + return personnelBeforeChangeList; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + public void setPersonnelBeforeChangeList(List<CorePersonnelHistory> personnelBeforeChangeList) { | ||
| 37 | + this.personnelBeforeChangeList = personnelBeforeChangeList; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + public List<CorePersonnelHistory> getPersonnelAfterChangeList() { | ||
| 41 | + return personnelAfterChangeList; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + public void setPersonnelAfterChangeList(List<CorePersonnelHistory> personnelAfterChangeList) { | ||
| 45 | + this.personnelAfterChangeList = personnelAfterChangeList; | ||
| 46 | + } | ||
| 19 | } | 47 | } |
| @@ -3,7 +3,6 @@ package com.lframework.xingyun.sc.controller.customer; | @@ -3,7 +3,6 @@ package com.lframework.xingyun.sc.controller.customer; | ||
| 3 | import com.lframework.starter.common.utils.StringUtil; | 3 | import com.lframework.starter.common.utils.StringUtil; |
| 4 | import com.lframework.starter.web.core.annotations.security.HasPermission; | 4 | import com.lframework.starter.web.core.annotations.security.HasPermission; |
| 5 | import com.lframework.starter.web.core.controller.DefaultBaseController; | 5 | import com.lframework.starter.web.core.controller.DefaultBaseController; |
| 6 | -import com.lframework.starter.web.core.utils.IdUtil; | ||
| 7 | import com.lframework.starter.web.core.utils.PageResultUtil; | 6 | import com.lframework.starter.web.core.utils.PageResultUtil; |
| 8 | import com.lframework.starter.web.core.components.resp.PageResult; | 7 | import com.lframework.starter.web.core.components.resp.PageResult; |
| 9 | import com.lframework.starter.web.core.components.resp.InvokeResult; | 8 | import com.lframework.starter.web.core.components.resp.InvokeResult; |
| @@ -14,11 +13,17 @@ import javax.validation.constraints.NotBlank; | @@ -14,11 +13,17 @@ import javax.validation.constraints.NotBlank; | ||
| 14 | import com.lframework.xingyun.sc.bo.customer.credit.ChangeData; | 13 | import com.lframework.xingyun.sc.bo.customer.credit.ChangeData; |
| 15 | import com.lframework.xingyun.sc.bo.customer.credit.ChangeItem; | 14 | import com.lframework.xingyun.sc.bo.customer.credit.ChangeItem; |
| 16 | import com.lframework.xingyun.sc.bo.customer.credit.GetCustomerCreditHistoryBo; | 15 | import com.lframework.xingyun.sc.bo.customer.credit.GetCustomerCreditHistoryBo; |
| 16 | +import com.lframework.xingyun.sc.entity.CorePersonnel; | ||
| 17 | +import com.lframework.xingyun.sc.entity.CorePersonnelHistory; | ||
| 17 | import com.lframework.xingyun.sc.entity.CustomerCredit; | 18 | import com.lframework.xingyun.sc.entity.CustomerCredit; |
| 18 | import com.lframework.xingyun.sc.entity.CustomerCreditHistory; | 19 | import com.lframework.xingyun.sc.entity.CustomerCreditHistory; |
| 20 | +import com.lframework.xingyun.sc.service.customer.CorePersonnelHistoryService; | ||
| 21 | +import com.lframework.xingyun.sc.service.customer.CorePersonnelService; | ||
| 19 | import com.lframework.xingyun.sc.service.customer.CustomerCreditHistoryService; | 22 | import com.lframework.xingyun.sc.service.customer.CustomerCreditHistoryService; |
| 20 | import com.lframework.xingyun.sc.service.customer.CustomerCreditService; | 23 | import com.lframework.xingyun.sc.service.customer.CustomerCreditService; |
| 21 | import com.lframework.xingyun.sc.vo.customer.credit.CreateCustomerCreditHistoryVo; | 24 | import com.lframework.xingyun.sc.vo.customer.credit.CreateCustomerCreditHistoryVo; |
| 25 | +import com.lframework.xingyun.sc.vo.customer.credit.QueryCorePersonnelHistoryVo; | ||
| 26 | +import com.lframework.xingyun.sc.vo.customer.credit.QueryCorePersonnelVo; | ||
| 22 | import com.lframework.xingyun.sc.vo.customer.credit.QueryCustomerCreditHistoryVo; | 27 | import com.lframework.xingyun.sc.vo.customer.credit.QueryCustomerCreditHistoryVo; |
| 23 | import io.swagger.annotations.ApiImplicitParam; | 28 | import io.swagger.annotations.ApiImplicitParam; |
| 24 | import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; | 29 | import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; |
| @@ -50,6 +55,10 @@ public class CustomerCreditHistoryController extends DefaultBaseController { | @@ -50,6 +55,10 @@ public class CustomerCreditHistoryController extends DefaultBaseController { | ||
| 50 | private CustomerCreditHistoryService customerCreditHistoryService; | 55 | private CustomerCreditHistoryService customerCreditHistoryService; |
| 51 | @Resource | 56 | @Resource |
| 52 | private CustomerCreditService customerCreditService; | 57 | private CustomerCreditService customerCreditService; |
| 58 | + @Resource | ||
| 59 | + private CorePersonnelHistoryService corePersonnelHistoryService; | ||
| 60 | + @Resource | ||
| 61 | + private CorePersonnelService corePersonnelService; | ||
| 53 | 62 | ||
| 54 | /** | 63 | /** |
| 55 | * 查询列表 | 64 | * 查询列表 |
| @@ -129,166 +138,62 @@ public class CustomerCreditHistoryController extends DefaultBaseController { | @@ -129,166 +138,62 @@ public class CustomerCreditHistoryController extends DefaultBaseController { | ||
| 129 | int sort = Integer.parseInt(data.getSort()); | 138 | int sort = Integer.parseInt(data.getSort()); |
| 130 | //变更次数 | 139 | //变更次数 |
| 131 | int size = query.size(); | 140 | int size = query.size(); |
| 132 | - List<ChangeItem> differencesWithIndex = new ArrayList<>(); | 141 | + List<ChangeItem> differencesWithIndex; |
| 142 | + //核心人员变更前 | ||
| 143 | + List<CorePersonnelHistory> personnelBeforeChangeList; | ||
| 144 | + //核心人员变更后 | ||
| 145 | + List<CorePersonnelHistory> personnelAfterChangeList; | ||
| 146 | + | ||
| 147 | + ChangeData result = new ChangeData(); | ||
| 133 | if (sort + 1 <= size) { | 148 | if (sort + 1 <= size) { |
| 134 | //data与customerCreditHistory的比较,其中data与为变更前,customerCreditHistory为变更后 | 149 | //data与customerCreditHistory的比较,其中data与为变更前,customerCreditHistory为变更后 |
| 135 | CustomerCreditHistory customerCreditHistory = map.get(String.valueOf(sort + 1)); | 150 | CustomerCreditHistory customerCreditHistory = map.get(String.valueOf(sort + 1)); |
| 136 | differencesWithIndex = customerCreditHistoryService.getDifferencesWithIndex(data, customerCreditHistory); | 151 | differencesWithIndex = customerCreditHistoryService.getDifferencesWithIndex(data, customerCreditHistory); |
| 137 | - | 152 | + //核心人员变更前 |
| 153 | + String idBefore = data.getId(); | ||
| 154 | + QueryCorePersonnelHistoryVo corePersonnelHistoryVo = new QueryCorePersonnelHistoryVo(); | ||
| 155 | + corePersonnelHistoryVo.setCreditHistoryId(idBefore); | ||
| 156 | + personnelBeforeChangeList = corePersonnelHistoryService.query(corePersonnelHistoryVo); | ||
| 157 | + | ||
| 158 | + //核心人员变更后 | ||
| 159 | + String idAfter = customerCreditHistory.getId(); | ||
| 160 | + QueryCorePersonnelHistoryVo corePersonnelHistoryVo1 = new QueryCorePersonnelHistoryVo(); | ||
| 161 | + corePersonnelHistoryVo1.setCreditHistoryId(idAfter); | ||
| 162 | + personnelAfterChangeList = corePersonnelHistoryService.query(corePersonnelHistoryVo1); | ||
| 163 | + | ||
| 164 | + //添加变更记录 | ||
| 165 | + corePersonnelHistoryService.updateWithChangeInfo(personnelBeforeChangeList, personnelAfterChangeList); | ||
| 166 | + result.setPersonnelBeforeChangeList(personnelBeforeChangeList); | ||
| 167 | + result.setPersonnelAfterChangeList(personnelAfterChangeList); | ||
| 138 | } else { | 168 | } else { |
| 139 | //现在的数据与这data相对比,其中data为变更前,customerCredit为变更后 | 169 | //现在的数据与这data相对比,其中data为变更前,customerCredit为变更后 |
| 140 | CustomerCredit customerCredit = customerCreditService.findById(creditId); | 170 | CustomerCredit customerCredit = customerCreditService.findById(creditId); |
| 141 | - CustomerCreditHistory customerCreditHistory = new CustomerCreditHistory(); | ||
| 142 | - if (!StringUtil.isBlank(customerCredit.getSerialNumber())) { | ||
| 143 | - customerCreditHistory.setSerialNumber(customerCredit.getSerialNumber()); | ||
| 144 | - } | ||
| 145 | - if (!StringUtil.isBlank(customerCredit.getRegion())) { | ||
| 146 | - customerCreditHistory.setRegion(customerCredit.getRegion()); | ||
| 147 | - } | ||
| 148 | - if (customerCredit.getRegisterDate() != null) { | ||
| 149 | - customerCreditHistory.setRegisterDate(customerCredit.getRegisterDate()); | ||
| 150 | - } | ||
| 151 | - if (!StringUtil.isBlank(customerCredit.getCustomerShortName())) { | ||
| 152 | - customerCreditHistory.setCustomerShortName(customerCredit.getCustomerShortName()); | ||
| 153 | - } | ||
| 154 | - customerCreditHistory.setEnterpriseType(customerCredit.getEnterpriseType()); | ||
| 155 | - customerCreditHistory.setCompanyId(customerCredit.getCompanyId()); | ||
| 156 | - if (!StringUtil.isBlank(customerCredit.getCompanyNature())) { | ||
| 157 | - customerCreditHistory.setCompanyNature(customerCredit.getCompanyNature()); | ||
| 158 | - } | ||
| 159 | - if (!StringUtil.isBlank(customerCredit.getCompanyAddress())) { | ||
| 160 | - customerCreditHistory.setCompanyAddress(customerCredit.getCompanyAddress()); | ||
| 161 | - } | ||
| 162 | - if (customerCredit.getRegisteredCapital() != null) { | ||
| 163 | - customerCreditHistory.setRegisteredCapital(customerCredit.getRegisteredCapital()); | ||
| 164 | - } | ||
| 165 | - if (!StringUtil.isBlank(customerCredit.getBankAccount())) { | ||
| 166 | - customerCreditHistory.setBankAccount(customerCredit.getBankAccount()); | ||
| 167 | - } | ||
| 168 | - if (!StringUtil.isBlank(customerCredit.getBankName())) { | ||
| 169 | - customerCreditHistory.setBankName(customerCredit.getBankName()); | ||
| 170 | - } | ||
| 171 | - if (!StringUtil.isBlank(customerCredit.getTaxNumber())) { | ||
| 172 | - customerCreditHistory.setTaxNumber(customerCredit.getTaxNumber()); | ||
| 173 | - } | ||
| 174 | - if (customerCredit.getRegistrationTime() != null) { | ||
| 175 | - customerCreditHistory.setRegistrationTime(customerCredit.getRegistrationTime()); | ||
| 176 | - } | ||
| 177 | - if (!StringUtil.isBlank(customerCredit.getBusinessYears())) { | ||
| 178 | - customerCreditHistory.setBusinessYears(customerCredit.getBusinessYears()); | ||
| 179 | - } | ||
| 180 | - if (!StringUtil.isBlank(customerCredit.getBusinessScope())) { | ||
| 181 | - customerCreditHistory.setBusinessScope(customerCredit.getBusinessScope()); | ||
| 182 | - } | ||
| 183 | - if (!StringUtil.isBlank(customerCredit.getBusinessProperty())) { | ||
| 184 | - customerCreditHistory.setBusinessProperty(customerCredit.getBusinessProperty()); | ||
| 185 | - } | ||
| 186 | - if (customerCredit.getLandArea() != null) { | ||
| 187 | - customerCreditHistory.setLandArea(customerCredit.getLandArea()); | ||
| 188 | - } | ||
| 189 | - if (!StringUtil.isBlank(customerCredit.getStorageConditions())) { | ||
| 190 | - customerCreditHistory.setStorageConditions(customerCredit.getStorageConditions()); | ||
| 191 | - } | ||
| 192 | - if (customerCredit.getEmployeeCount() != null) { | ||
| 193 | - customerCreditHistory.setEmployeeCount(customerCredit.getEmployeeCount()); | ||
| 194 | - } | ||
| 195 | - if (!StringUtil.isBlank(customerCredit.getEquipmentAttributes())) { | ||
| 196 | - customerCreditHistory.setEquipmentAttributes(customerCredit.getEquipmentAttributes()); | ||
| 197 | - } | ||
| 198 | - if (!StringUtil.isBlank(customerCredit.getAssetEvaluation())) { | ||
| 199 | - customerCreditHistory.setAssetEvaluation(customerCredit.getAssetEvaluation()); | ||
| 200 | - } | ||
| 201 | - if (!StringUtil.isBlank(customerCredit.getLastYearSales())) { | ||
| 202 | - customerCreditHistory.setLastYearSales(customerCredit.getLastYearSales()); | ||
| 203 | - } | ||
| 204 | - if (!StringUtil.isBlank(customerCredit.getMonthlyAvgSales())) { | ||
| 205 | - customerCreditHistory.setMonthlyAvgSales(customerCredit.getMonthlyAvgSales()); | ||
| 206 | - } | ||
| 207 | - if (!StringUtil.isBlank(customerCredit.getInvoiceItemUnit())) { | ||
| 208 | - customerCreditHistory.setInvoiceItemUnit(customerCredit.getInvoiceItemUnit()); | ||
| 209 | - } | ||
| 210 | - if (!StringUtil.isBlank(customerCredit.getCertificationCertificate())) { | ||
| 211 | - customerCreditHistory.setCertificationCertificate(customerCredit.getCertificationCertificate()); | ||
| 212 | - } | ||
| 213 | - if (!StringUtil.isBlank(customerCredit.getProductMatch())) { | ||
| 214 | - customerCreditHistory.setProductMatch(customerCredit.getProductMatch()); | ||
| 215 | - } | ||
| 216 | - if (!StringUtil.isBlank(customerCredit.getMajorCustomers())) { | ||
| 217 | - customerCreditHistory.setMajorCustomers(customerCredit.getMajorCustomers()); | ||
| 218 | - } | ||
| 219 | - if (!StringUtil.isBlank(customerCredit.getMainProjects())) { | ||
| 220 | - customerCreditHistory.setMainProjects(customerCredit.getMainProjects()); | ||
| 221 | - } | ||
| 222 | - if (!StringUtil.isBlank(customerCredit.getIndustryInvolved())) { | ||
| 223 | - customerCreditHistory.setIndustryInvolved(customerCredit.getIndustryInvolved()); | ||
| 224 | - } | ||
| 225 | - if (!StringUtil.isBlank(customerCredit.getIndustryExperience())) { | ||
| 226 | - customerCreditHistory.setIndustryExperience(customerCredit.getIndustryExperience()); | ||
| 227 | - } | ||
| 228 | - if (!StringUtil.isBlank(customerCredit.getHasDispute())) { | ||
| 229 | - customerCreditHistory.setHasDispute(customerCredit.getHasDispute()); | ||
| 230 | - } | ||
| 231 | - if (!StringUtil.isBlank(customerCredit.getCooperationStartDate())) { | ||
| 232 | - customerCreditHistory.setCooperationStartDate(customerCredit.getCooperationStartDate()); | ||
| 233 | - } | ||
| 234 | - if (!StringUtil.isBlank(customerCredit.getMonthlyAvgVolume())) { | ||
| 235 | - customerCreditHistory.setMonthlyAvgVolume(customerCredit.getMonthlyAvgVolume()); | ||
| 236 | - } | ||
| 237 | - if (!StringUtil.isBlank(customerCredit.getIsVerbalAgreement())) { | ||
| 238 | - customerCreditHistory.setIsVerbalAgreement(customerCredit.getIsVerbalAgreement()); | ||
| 239 | - } | ||
| 240 | - if (!StringUtil.isBlank(customerCredit.getOtherAgreements())) { | ||
| 241 | - customerCreditHistory.setOtherAgreements(customerCredit.getOtherAgreements()); | ||
| 242 | - } | ||
| 243 | - if (!StringUtil.isBlank(customerCredit.getHasLongTermContract())) { | ||
| 244 | - customerCreditHistory.setHasLongTermContract(customerCredit.getHasLongTermContract()); | ||
| 245 | - } | ||
| 246 | - if (!StringUtil.isBlank(customerCredit.getContractType())) { | ||
| 247 | - customerCreditHistory.setContractType(customerCredit.getContractType()); | ||
| 248 | - } | ||
| 249 | - if (!StringUtil.isBlank(customerCredit.getHasInterruption())) { | ||
| 250 | - customerCreditHistory.setHasInterruption(customerCredit.getHasInterruption()); | ||
| 251 | - } | ||
| 252 | - if (!StringUtil.isBlank(customerCredit.getSettlementPeriod())) { | ||
| 253 | - customerCreditHistory.setSettlementPeriod(customerCredit.getSettlementPeriod()); | ||
| 254 | - } | ||
| 255 | - if (!StringUtil.isBlank(customerCredit.getMaterialSupplyPlan())) { | ||
| 256 | - customerCreditHistory.setMaterialSupplyPlan(customerCredit.getMaterialSupplyPlan()); | ||
| 257 | - } | ||
| 258 | - customerCreditHistory.setSuggestedCategory(customerCredit.getSuggestedCategory()); | ||
| 259 | - if (!StringUtil.isBlank(customerCredit.getCreditLimit())) { | ||
| 260 | - customerCreditHistory.setCreditLimit(customerCredit.getCreditLimit()); | ||
| 261 | - } | ||
| 262 | - if (!StringUtil.isBlank(customerCredit.getInvestigator())) { | ||
| 263 | - customerCreditHistory.setInvestigator(customerCredit.getInvestigator()); | ||
| 264 | - } | ||
| 265 | - if (!StringUtil.isBlank(customerCredit.getSupervisorReview())) { | ||
| 266 | - customerCreditHistory.setSupervisorReview(customerCredit.getSupervisorReview()); | ||
| 267 | - } | ||
| 268 | - if (!StringUtil.isBlank(customerCredit.getAnnualTotalSales())) { | ||
| 269 | - customerCreditHistory.setAnnualTotalSales(customerCredit.getAnnualTotalSales()); | ||
| 270 | - } | ||
| 271 | - if (!StringUtil.isBlank(customerCredit.getMainIndustry())) { | ||
| 272 | - customerCreditHistory.setMainIndustry(customerCredit.getMainIndustry()); | ||
| 273 | - } | ||
| 274 | - if (!StringUtil.isBlank(customerCredit.getAnnualMaterialOverview())) { | ||
| 275 | - customerCreditHistory.setAnnualMaterialOverview(customerCredit.getAnnualMaterialOverview()); | ||
| 276 | - } | ||
| 277 | - if (!StringUtil.isBlank(customerCredit.getCompanySettlementPeriod())) { | ||
| 278 | - customerCreditHistory.setCompanySettlementPeriod(customerCredit.getCompanySettlementPeriod()); | ||
| 279 | - } | ||
| 280 | - if (!StringUtil.isBlank(customerCredit.getCompanyCreditLimit())) { | ||
| 281 | - customerCreditHistory.setCompanyCreditLimit(customerCredit.getCompanyCreditLimit()); | ||
| 282 | - } | ||
| 283 | - if (!StringUtil.isBlank(customerCredit.getCompanyMaterialSupplyPlan())) { | ||
| 284 | - customerCreditHistory.setCompanyMaterialSupplyPlan(customerCredit.getCompanyMaterialSupplyPlan()); | ||
| 285 | - } | ||
| 286 | - customerCreditHistory.setCompanySuggestedCategory(customerCredit.getCompanySuggestedCategory()); | ||
| 287 | - customerCreditHistory.setStatus(customerCredit.getStatus()); | 171 | + CustomerCreditHistory customerCreditHistory = customerCreditHistoryService.changeCustomerCredit(customerCredit); |
| 288 | differencesWithIndex = customerCreditHistoryService.getDifferencesWithIndex(data, customerCreditHistory); | 172 | differencesWithIndex = customerCreditHistoryService.getDifferencesWithIndex(data, customerCreditHistory); |
| 173 | + //核心人员变更前 | ||
| 174 | + String idBefore = data.getId(); | ||
| 175 | + QueryCorePersonnelHistoryVo corePersonnelHistoryVo = new QueryCorePersonnelHistoryVo(); | ||
| 176 | + corePersonnelHistoryVo.setCreditHistoryId(idBefore); | ||
| 177 | + personnelBeforeChangeList = corePersonnelHistoryService.query(corePersonnelHistoryVo); | ||
| 178 | + | ||
| 179 | + //核心人员变更后 | ||
| 180 | + String idAfter = customerCredit.getId(); | ||
| 181 | + QueryCorePersonnelVo queryCorePersonnelVo = new QueryCorePersonnelVo(); | ||
| 182 | + queryCorePersonnelVo.setCreditId(idAfter); | ||
| 183 | + List<CorePersonnel> query1 = corePersonnelService.query(queryCorePersonnelVo); | ||
| 184 | + List<CorePersonnelHistory> query2 = new ArrayList<>(); | ||
| 185 | + if (query1 != null) { | ||
| 186 | + for (CorePersonnel corePersonnel : query1) { | ||
| 187 | + CorePersonnelHistory corePersonnelHistory = corePersonnelHistoryService.changeCorePersonnel(corePersonnel); | ||
| 188 | + query2.add(corePersonnelHistory); | ||
| 189 | + } | ||
| 190 | + } | ||
| 191 | + //添加变更记录 | ||
| 192 | + corePersonnelHistoryService.updateWithChangeInfo(personnelBeforeChangeList, query2); | ||
| 193 | + result.setPersonnelBeforeChangeList(personnelBeforeChangeList); | ||
| 194 | + result.setPersonnelAfterChangeList(query2); | ||
| 289 | } | 195 | } |
| 290 | 196 | ||
| 291 | - ChangeData result = new ChangeData(); | ||
| 292 | result.setOtherChangeList(differencesWithIndex); | 197 | result.setOtherChangeList(differencesWithIndex); |
| 293 | 198 | ||
| 294 | return InvokeResultBuilder.success(result); | 199 | return InvokeResultBuilder.success(result); |
| @@ -48,46 +48,97 @@ public class CorePersonnelHistory extends BaseEntity implements BaseDto { | @@ -48,46 +48,97 @@ public class CorePersonnelHistory extends BaseEntity implements BaseDto { | ||
| 48 | private String name; | 48 | private String name; |
| 49 | 49 | ||
| 50 | /** | 50 | /** |
| 51 | + * 姓名是否变更 | ||
| 52 | + */ | ||
| 53 | + private Boolean nameChange; | ||
| 54 | + | ||
| 55 | + /** | ||
| 51 | * 性别 | 56 | * 性别 |
| 52 | */ | 57 | */ |
| 53 | private String sex; | 58 | private String sex; |
| 54 | 59 | ||
| 55 | /** | 60 | /** |
| 61 | + * 性别是否变更 | ||
| 62 | + */ | ||
| 63 | + private Boolean sexChange; | ||
| 64 | + | ||
| 65 | + /** | ||
| 56 | * 籍贯 | 66 | * 籍贯 |
| 57 | */ | 67 | */ |
| 58 | private String nativePlace; | 68 | private String nativePlace; |
| 59 | 69 | ||
| 60 | /** | 70 | /** |
| 71 | + * 籍贯是否变更 | ||
| 72 | + */ | ||
| 73 | + private Boolean nativePlaceChange; | ||
| 74 | + | ||
| 75 | + /** | ||
| 61 | * 年龄 | 76 | * 年龄 |
| 62 | */ | 77 | */ |
| 63 | private String age; | 78 | private String age; |
| 64 | 79 | ||
| 65 | /** | 80 | /** |
| 81 | + * 年龄是否变更 | ||
| 82 | + */ | ||
| 83 | + private Boolean ageChange; | ||
| 84 | + | ||
| 85 | + /** | ||
| 66 | * 职务 | 86 | * 职务 |
| 67 | */ | 87 | */ |
| 68 | private String position; | 88 | private String position; |
| 69 | 89 | ||
| 70 | /** | 90 | /** |
| 91 | + * 职务是否变更 | ||
| 92 | + */ | ||
| 93 | + private Boolean positionChange; | ||
| 94 | + | ||
| 95 | + /** | ||
| 71 | * 手机 | 96 | * 手机 |
| 72 | */ | 97 | */ |
| 73 | private String mobile; | 98 | private String mobile; |
| 74 | 99 | ||
| 75 | /** | 100 | /** |
| 101 | + * 手机是否变更 | ||
| 102 | + */ | ||
| 103 | + private Boolean mobileChange; | ||
| 104 | + | ||
| 105 | + | ||
| 106 | + /** | ||
| 76 | * 固定电话 | 107 | * 固定电话 |
| 77 | */ | 108 | */ |
| 78 | private String phone; | 109 | private String phone; |
| 79 | 110 | ||
| 80 | /** | 111 | /** |
| 112 | + * 固定电话是否变更 | ||
| 113 | + */ | ||
| 114 | + private Boolean phoneChange; | ||
| 115 | + | ||
| 116 | + /** | ||
| 81 | * 邮箱地址 | 117 | * 邮箱地址 |
| 82 | */ | 118 | */ |
| 83 | private String email; | 119 | private String email; |
| 84 | 120 | ||
| 85 | /** | 121 | /** |
| 122 | + * 邮箱地址是否变更 | ||
| 123 | + */ | ||
| 124 | + private Boolean emailChange; | ||
| 125 | + | ||
| 126 | + /** | ||
| 86 | * 现住址 | 127 | * 现住址 |
| 87 | */ | 128 | */ |
| 88 | private String address; | 129 | private String address; |
| 89 | 130 | ||
| 90 | /** | 131 | /** |
| 132 | + * 现住址是否变更 | ||
| 133 | + */ | ||
| 134 | + private Boolean addressChange; | ||
| 135 | + | ||
| 136 | + /** | ||
| 137 | + * 新增/删除/变更 | ||
| 138 | + */ | ||
| 139 | + private String type; | ||
| 140 | + | ||
| 141 | + /** | ||
| 91 | * 创建人ID | 142 | * 创建人ID |
| 92 | */ | 143 | */ |
| 93 | @TableField(fill = FieldFill.INSERT) | 144 | @TableField(fill = FieldFill.INSERT) |
| @@ -12,6 +12,7 @@ import com.lframework.starter.web.core.annotations.oplog.OpLog; | @@ -12,6 +12,7 @@ import com.lframework.starter.web.core.annotations.oplog.OpLog; | ||
| 12 | import com.lframework.starter.web.core.utils.PageHelperUtil; | 12 | import com.lframework.starter.web.core.utils.PageHelperUtil; |
| 13 | import com.lframework.starter.common.utils.Assert; | 13 | import com.lframework.starter.common.utils.Assert; |
| 14 | import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; | 14 | import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; |
| 15 | +import com.lframework.xingyun.sc.entity.CorePersonnel; | ||
| 15 | import com.lframework.xingyun.sc.entity.CorePersonnelHistory; | 16 | import com.lframework.xingyun.sc.entity.CorePersonnelHistory; |
| 16 | import com.lframework.xingyun.sc.mappers.CorePersonnelHistoryMapper; | 17 | import com.lframework.xingyun.sc.mappers.CorePersonnelHistoryMapper; |
| 17 | import com.lframework.xingyun.sc.service.customer.CorePersonnelHistoryService; | 18 | import com.lframework.xingyun.sc.service.customer.CorePersonnelHistoryService; |
| @@ -22,7 +23,7 @@ import org.springframework.cache.annotation.CacheEvict; | @@ -22,7 +23,7 @@ import org.springframework.cache.annotation.CacheEvict; | ||
| 22 | import org.springframework.cache.annotation.Cacheable; | 23 | import org.springframework.cache.annotation.Cacheable; |
| 23 | import org.springframework.stereotype.Service; | 24 | import org.springframework.stereotype.Service; |
| 24 | 25 | ||
| 25 | -import java.util.List; | 26 | +import java.util.*; |
| 26 | 27 | ||
| 27 | @Service | 28 | @Service |
| 28 | public class CorePersonnelHistoryServiceImpl extends BaseMpServiceImpl<CorePersonnelHistoryMapper, CorePersonnelHistory> implements CorePersonnelHistoryService { | 29 | public class CorePersonnelHistoryServiceImpl extends BaseMpServiceImpl<CorePersonnelHistoryMapper, CorePersonnelHistory> implements CorePersonnelHistoryService { |
| @@ -106,6 +107,141 @@ public class CorePersonnelHistoryServiceImpl extends BaseMpServiceImpl<CorePerso | @@ -106,6 +107,141 @@ public class CorePersonnelHistoryServiceImpl extends BaseMpServiceImpl<CorePerso | ||
| 106 | getBaseMapper().deleteById(id); | 107 | getBaseMapper().deleteById(id); |
| 107 | } | 108 | } |
| 108 | 109 | ||
| 110 | + | ||
| 111 | + /** | ||
| 112 | + * 完善两个核心人员列表中的 type 和 xxxChange 字段 | ||
| 113 | + * 不增删对象,仅完善字段 | ||
| 114 | + * | ||
| 115 | + * @param personnelBeforeChangeList 变更前列表(会被完善字段) | ||
| 116 | + * @param personnelAfterChangeList 变更后列表(会被完善字段) | ||
| 117 | + */ | ||
| 118 | + public void updateWithChangeInfo( | ||
| 119 | + List<CorePersonnelHistory> personnelBeforeChangeList, | ||
| 120 | + List<CorePersonnelHistory> personnelAfterChangeList) { | ||
| 121 | + | ||
| 122 | + // 允许 null 输入 | ||
| 123 | + if (personnelBeforeChangeList == null) personnelBeforeChangeList = new ArrayList<>(); | ||
| 124 | + if (personnelAfterChangeList == null) personnelAfterChangeList = new ArrayList<>(); | ||
| 125 | + | ||
| 126 | + // 构建 Map<id, obj> 便于快速查找 | ||
| 127 | + Map<String, CorePersonnelHistory> beforeMap = toMap(personnelBeforeChangeList); | ||
| 128 | + Map<String, CorePersonnelHistory> afterMap = toMap(personnelAfterChangeList); | ||
| 129 | + | ||
| 130 | + // === 1. 处理变更前列表:判断是 DELETE 还是 UPDATE === | ||
| 131 | + for (CorePersonnelHistory beforeItem : personnelBeforeChangeList) { | ||
| 132 | + String id = beforeItem.getPersonnelId(); | ||
| 133 | + CorePersonnelHistory afterItem = afterMap.get(id); | ||
| 134 | + | ||
| 135 | + if (afterItem == null) { | ||
| 136 | + // 只在 before 中存在 → 删除 | ||
| 137 | + beforeItem.setType("DELETE"); | ||
| 138 | + setAllChangeFields(beforeItem, false); // 删除时字段无变化 | ||
| 139 | + } else { | ||
| 140 | + // 在前后都存在 → 修改 | ||
| 141 | + beforeItem.setType("UPDATE"); | ||
| 142 | + // 比较字段,设置 change 标志 | ||
| 143 | + compareAndSetChanges(beforeItem, beforeItem, afterItem); | ||
| 144 | + } | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + // === 2. 处理变更后列表:判断是 ADD 还是 UPDATE === | ||
| 148 | + for (CorePersonnelHistory afterItem : personnelAfterChangeList) { | ||
| 149 | + String id = afterItem.getPersonnelId(); | ||
| 150 | + CorePersonnelHistory beforeItem = beforeMap.get(id); | ||
| 151 | + | ||
| 152 | + if (beforeItem == null) { | ||
| 153 | + // 只在 after 中存在 → 新增 | ||
| 154 | + afterItem.setType("ADD"); | ||
| 155 | + setAllChangeFields(afterItem, false); // 新增时字段视为“未变”(或可设 true) | ||
| 156 | + } else { | ||
| 157 | + // 在前后都存在 → 修改 | ||
| 158 | + afterItem.setType("UPDATE"); | ||
| 159 | + // 比较字段,设置 change 标志 | ||
| 160 | + compareAndSetChanges(afterItem, beforeItem, afterItem); | ||
| 161 | + } | ||
| 162 | + } | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + // 辅助方法:转为 Map<id, entity> | ||
| 166 | + private Map<String, CorePersonnelHistory> toMap(List<CorePersonnelHistory> list) { | ||
| 167 | + Map<String, CorePersonnelHistory> map = new HashMap<>(); | ||
| 168 | + for (CorePersonnelHistory obj : list) { | ||
| 169 | + if (obj != null && obj.getPersonnelId() != null) { | ||
| 170 | + map.put(obj.getPersonnelId(), obj); | ||
| 171 | + } | ||
| 172 | + } | ||
| 173 | + return map; | ||
| 174 | + } | ||
| 175 | + | ||
| 176 | + // 辅助方法:设置所有 change 字段 | ||
| 177 | + private void setAllChangeFields(CorePersonnelHistory item, boolean value) { | ||
| 178 | + if (item == null) return; | ||
| 179 | + item.setNameChange(value); | ||
| 180 | + item.setSexChange(value); | ||
| 181 | + item.setNativePlaceChange(value); | ||
| 182 | + item.setAgeChange(value); | ||
| 183 | + item.setPositionChange(value); | ||
| 184 | + item.setMobileChange(value); | ||
| 185 | + item.setPhoneChange(value); | ||
| 186 | + item.setEmailChange(value); | ||
| 187 | + item.setAddressChange(value); | ||
| 188 | + } | ||
| 189 | + | ||
| 190 | + /** | ||
| 191 | + * 比较 before 和 after,将变化的字段在 target 上设为 true | ||
| 192 | + */ | ||
| 193 | + private void compareAndSetChanges( | ||
| 194 | + CorePersonnelHistory target, | ||
| 195 | + CorePersonnelHistory before, | ||
| 196 | + CorePersonnelHistory after) { | ||
| 197 | + | ||
| 198 | + if (target == null || before == null || after == null) return; | ||
| 199 | + | ||
| 200 | + target.setNameChange(!Objects.equals(before.getName(), after.getName())); | ||
| 201 | + target.setSexChange(!Objects.equals(before.getSex(), after.getSex())); | ||
| 202 | + target.setNativePlaceChange(!Objects.equals(before.getNativePlace(), after.getNativePlace())); | ||
| 203 | + target.setAgeChange(!Objects.equals(before.getAge(), after.getAge())); | ||
| 204 | + target.setPositionChange(!Objects.equals(before.getPosition(), after.getPosition())); | ||
| 205 | + target.setMobileChange(!Objects.equals(before.getMobile(), after.getMobile())); | ||
| 206 | + target.setPhoneChange(!Objects.equals(before.getPhone(), after.getPhone())); | ||
| 207 | + target.setEmailChange(!Objects.equals(before.getEmail(), after.getEmail())); | ||
| 208 | + target.setAddressChange(!Objects.equals(before.getAddress(), after.getAddress())); | ||
| 209 | + } | ||
| 210 | + | ||
| 211 | + public CorePersonnelHistory changeCorePersonnel(CorePersonnel vo) { | ||
| 212 | + CorePersonnelHistory data = new CorePersonnelHistory(); | ||
| 213 | + data.setPersonId(vo.getPersonId()); | ||
| 214 | + data.setName(vo.getName()); | ||
| 215 | + if (!StringUtil.isBlank(vo.getSex())) { | ||
| 216 | + data.setSex(vo.getSex()); | ||
| 217 | + } | ||
| 218 | + if (!StringUtil.isBlank(vo.getNativePlace())) { | ||
| 219 | + data.setNativePlace(vo.getNativePlace()); | ||
| 220 | + } | ||
| 221 | + if (!StringUtil.isBlank(vo.getAge())) { | ||
| 222 | + data.setAge(vo.getAge()); | ||
| 223 | + } | ||
| 224 | + if (!StringUtil.isBlank(vo.getPosition())) { | ||
| 225 | + data.setPosition(vo.getPosition()); | ||
| 226 | + } | ||
| 227 | + if (!StringUtil.isBlank(vo.getMobile())) { | ||
| 228 | + data.setMobile(vo.getMobile()); | ||
| 229 | + } | ||
| 230 | + if (!StringUtil.isBlank(vo.getPhone())) { | ||
| 231 | + data.setPhone(vo.getPhone()); | ||
| 232 | + } | ||
| 233 | + if (!StringUtil.isBlank(vo.getEmail())) { | ||
| 234 | + data.setEmail(vo.getEmail()); | ||
| 235 | + } | ||
| 236 | + if (!StringUtil.isBlank(vo.getAddress())) { | ||
| 237 | + data.setAddress(vo.getAddress()); | ||
| 238 | + } | ||
| 239 | + if (!StringUtil.isBlank(vo.getPersonId())) { | ||
| 240 | + data.setPersonId(vo.getPersonId()); | ||
| 241 | + } | ||
| 242 | + return data; | ||
| 243 | + } | ||
| 244 | + | ||
| 109 | @CacheEvict(value = CorePersonnelHistory.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") | 245 | @CacheEvict(value = CorePersonnelHistory.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") |
| 110 | @Override | 246 | @Override |
| 111 | public void cleanCacheByKey(Serializable key) { | 247 | public void cleanCacheByKey(Serializable key) { |
| @@ -16,6 +16,7 @@ import com.lframework.xingyun.basedata.entity.Customer; | @@ -16,6 +16,7 @@ import com.lframework.xingyun.basedata.entity.Customer; | ||
| 16 | import com.lframework.xingyun.basedata.service.customer.CustomerService; | 16 | import com.lframework.xingyun.basedata.service.customer.CustomerService; |
| 17 | import com.lframework.xingyun.sc.Label; | 17 | import com.lframework.xingyun.sc.Label; |
| 18 | import com.lframework.xingyun.sc.bo.customer.credit.ChangeItem; | 18 | import com.lframework.xingyun.sc.bo.customer.credit.ChangeItem; |
| 19 | +import com.lframework.xingyun.sc.entity.CustomerCredit; | ||
| 19 | import com.lframework.xingyun.sc.entity.CustomerCreditHistory; | 20 | import com.lframework.xingyun.sc.entity.CustomerCreditHistory; |
| 20 | import com.lframework.xingyun.sc.mappers.CustomerCreditHistoryMapper; | 21 | import com.lframework.xingyun.sc.mappers.CustomerCreditHistoryMapper; |
| 21 | import com.lframework.xingyun.sc.service.customer.CustomerCreditHistoryService; | 22 | import com.lframework.xingyun.sc.service.customer.CustomerCreditHistoryService; |
| @@ -379,6 +380,157 @@ public class CustomerCreditHistoryServiceImpl extends BaseMpServiceImpl<Customer | @@ -379,6 +380,157 @@ public class CustomerCreditHistoryServiceImpl extends BaseMpServiceImpl<Customer | ||
| 379 | return list; | 380 | return list; |
| 380 | } | 381 | } |
| 381 | 382 | ||
| 383 | + public CustomerCreditHistory changeCustomerCredit(CustomerCredit customerCredit) { | ||
| 384 | + CustomerCreditHistory customerCreditHistory = new CustomerCreditHistory(); | ||
| 385 | + if (!StringUtil.isBlank(customerCredit.getSerialNumber())) { | ||
| 386 | + customerCreditHistory.setSerialNumber(customerCredit.getSerialNumber()); | ||
| 387 | + } | ||
| 388 | + if (!StringUtil.isBlank(customerCredit.getRegion())) { | ||
| 389 | + customerCreditHistory.setRegion(customerCredit.getRegion()); | ||
| 390 | + } | ||
| 391 | + if (customerCredit.getRegisterDate() != null) { | ||
| 392 | + customerCreditHistory.setRegisterDate(customerCredit.getRegisterDate()); | ||
| 393 | + } | ||
| 394 | + if (!StringUtil.isBlank(customerCredit.getCustomerShortName())) { | ||
| 395 | + customerCreditHistory.setCustomerShortName(customerCredit.getCustomerShortName()); | ||
| 396 | + } | ||
| 397 | + customerCreditHistory.setEnterpriseType(customerCredit.getEnterpriseType()); | ||
| 398 | + customerCreditHistory.setCompanyId(customerCredit.getCompanyId()); | ||
| 399 | + if (!StringUtil.isBlank(customerCredit.getCompanyNature())) { | ||
| 400 | + customerCreditHistory.setCompanyNature(customerCredit.getCompanyNature()); | ||
| 401 | + } | ||
| 402 | + if (!StringUtil.isBlank(customerCredit.getCompanyAddress())) { | ||
| 403 | + customerCreditHistory.setCompanyAddress(customerCredit.getCompanyAddress()); | ||
| 404 | + } | ||
| 405 | + if (customerCredit.getRegisteredCapital() != null) { | ||
| 406 | + customerCreditHistory.setRegisteredCapital(customerCredit.getRegisteredCapital()); | ||
| 407 | + } | ||
| 408 | + if (!StringUtil.isBlank(customerCredit.getBankAccount())) { | ||
| 409 | + customerCreditHistory.setBankAccount(customerCredit.getBankAccount()); | ||
| 410 | + } | ||
| 411 | + if (!StringUtil.isBlank(customerCredit.getBankName())) { | ||
| 412 | + customerCreditHistory.setBankName(customerCredit.getBankName()); | ||
| 413 | + } | ||
| 414 | + if (!StringUtil.isBlank(customerCredit.getTaxNumber())) { | ||
| 415 | + customerCreditHistory.setTaxNumber(customerCredit.getTaxNumber()); | ||
| 416 | + } | ||
| 417 | + if (customerCredit.getRegistrationTime() != null) { | ||
| 418 | + customerCreditHistory.setRegistrationTime(customerCredit.getRegistrationTime()); | ||
| 419 | + } | ||
| 420 | + if (!StringUtil.isBlank(customerCredit.getBusinessYears())) { | ||
| 421 | + customerCreditHistory.setBusinessYears(customerCredit.getBusinessYears()); | ||
| 422 | + } | ||
| 423 | + if (!StringUtil.isBlank(customerCredit.getBusinessScope())) { | ||
| 424 | + customerCreditHistory.setBusinessScope(customerCredit.getBusinessScope()); | ||
| 425 | + } | ||
| 426 | + if (!StringUtil.isBlank(customerCredit.getBusinessProperty())) { | ||
| 427 | + customerCreditHistory.setBusinessProperty(customerCredit.getBusinessProperty()); | ||
| 428 | + } | ||
| 429 | + if (customerCredit.getLandArea() != null) { | ||
| 430 | + customerCreditHistory.setLandArea(customerCredit.getLandArea()); | ||
| 431 | + } | ||
| 432 | + if (!StringUtil.isBlank(customerCredit.getStorageConditions())) { | ||
| 433 | + customerCreditHistory.setStorageConditions(customerCredit.getStorageConditions()); | ||
| 434 | + } | ||
| 435 | + if (customerCredit.getEmployeeCount() != null) { | ||
| 436 | + customerCreditHistory.setEmployeeCount(customerCredit.getEmployeeCount()); | ||
| 437 | + } | ||
| 438 | + if (!StringUtil.isBlank(customerCredit.getEquipmentAttributes())) { | ||
| 439 | + customerCreditHistory.setEquipmentAttributes(customerCredit.getEquipmentAttributes()); | ||
| 440 | + } | ||
| 441 | + if (!StringUtil.isBlank(customerCredit.getAssetEvaluation())) { | ||
| 442 | + customerCreditHistory.setAssetEvaluation(customerCredit.getAssetEvaluation()); | ||
| 443 | + } | ||
| 444 | + if (!StringUtil.isBlank(customerCredit.getLastYearSales())) { | ||
| 445 | + customerCreditHistory.setLastYearSales(customerCredit.getLastYearSales()); | ||
| 446 | + } | ||
| 447 | + if (!StringUtil.isBlank(customerCredit.getMonthlyAvgSales())) { | ||
| 448 | + customerCreditHistory.setMonthlyAvgSales(customerCredit.getMonthlyAvgSales()); | ||
| 449 | + } | ||
| 450 | + if (!StringUtil.isBlank(customerCredit.getInvoiceItemUnit())) { | ||
| 451 | + customerCreditHistory.setInvoiceItemUnit(customerCredit.getInvoiceItemUnit()); | ||
| 452 | + } | ||
| 453 | + if (!StringUtil.isBlank(customerCredit.getCertificationCertificate())) { | ||
| 454 | + customerCreditHistory.setCertificationCertificate(customerCredit.getCertificationCertificate()); | ||
| 455 | + } | ||
| 456 | + if (!StringUtil.isBlank(customerCredit.getProductMatch())) { | ||
| 457 | + customerCreditHistory.setProductMatch(customerCredit.getProductMatch()); | ||
| 458 | + } | ||
| 459 | + if (!StringUtil.isBlank(customerCredit.getMajorCustomers())) { | ||
| 460 | + customerCreditHistory.setMajorCustomers(customerCredit.getMajorCustomers()); | ||
| 461 | + } | ||
| 462 | + if (!StringUtil.isBlank(customerCredit.getMainProjects())) { | ||
| 463 | + customerCreditHistory.setMainProjects(customerCredit.getMainProjects()); | ||
| 464 | + } | ||
| 465 | + if (!StringUtil.isBlank(customerCredit.getIndustryInvolved())) { | ||
| 466 | + customerCreditHistory.setIndustryInvolved(customerCredit.getIndustryInvolved()); | ||
| 467 | + } | ||
| 468 | + if (!StringUtil.isBlank(customerCredit.getIndustryExperience())) { | ||
| 469 | + customerCreditHistory.setIndustryExperience(customerCredit.getIndustryExperience()); | ||
| 470 | + } | ||
| 471 | + if (!StringUtil.isBlank(customerCredit.getHasDispute())) { | ||
| 472 | + customerCreditHistory.setHasDispute(customerCredit.getHasDispute()); | ||
| 473 | + } | ||
| 474 | + if (!StringUtil.isBlank(customerCredit.getCooperationStartDate())) { | ||
| 475 | + customerCreditHistory.setCooperationStartDate(customerCredit.getCooperationStartDate()); | ||
| 476 | + } | ||
| 477 | + if (!StringUtil.isBlank(customerCredit.getMonthlyAvgVolume())) { | ||
| 478 | + customerCreditHistory.setMonthlyAvgVolume(customerCredit.getMonthlyAvgVolume()); | ||
| 479 | + } | ||
| 480 | + if (!StringUtil.isBlank(customerCredit.getIsVerbalAgreement())) { | ||
| 481 | + customerCreditHistory.setIsVerbalAgreement(customerCredit.getIsVerbalAgreement()); | ||
| 482 | + } | ||
| 483 | + if (!StringUtil.isBlank(customerCredit.getOtherAgreements())) { | ||
| 484 | + customerCreditHistory.setOtherAgreements(customerCredit.getOtherAgreements()); | ||
| 485 | + } | ||
| 486 | + if (!StringUtil.isBlank(customerCredit.getHasLongTermContract())) { | ||
| 487 | + customerCreditHistory.setHasLongTermContract(customerCredit.getHasLongTermContract()); | ||
| 488 | + } | ||
| 489 | + if (!StringUtil.isBlank(customerCredit.getContractType())) { | ||
| 490 | + customerCreditHistory.setContractType(customerCredit.getContractType()); | ||
| 491 | + } | ||
| 492 | + if (!StringUtil.isBlank(customerCredit.getHasInterruption())) { | ||
| 493 | + customerCreditHistory.setHasInterruption(customerCredit.getHasInterruption()); | ||
| 494 | + } | ||
| 495 | + if (!StringUtil.isBlank(customerCredit.getSettlementPeriod())) { | ||
| 496 | + customerCreditHistory.setSettlementPeriod(customerCredit.getSettlementPeriod()); | ||
| 497 | + } | ||
| 498 | + if (!StringUtil.isBlank(customerCredit.getMaterialSupplyPlan())) { | ||
| 499 | + customerCreditHistory.setMaterialSupplyPlan(customerCredit.getMaterialSupplyPlan()); | ||
| 500 | + } | ||
| 501 | + customerCreditHistory.setSuggestedCategory(customerCredit.getSuggestedCategory()); | ||
| 502 | + if (!StringUtil.isBlank(customerCredit.getCreditLimit())) { | ||
| 503 | + customerCreditHistory.setCreditLimit(customerCredit.getCreditLimit()); | ||
| 504 | + } | ||
| 505 | + if (!StringUtil.isBlank(customerCredit.getInvestigator())) { | ||
| 506 | + customerCreditHistory.setInvestigator(customerCredit.getInvestigator()); | ||
| 507 | + } | ||
| 508 | + if (!StringUtil.isBlank(customerCredit.getSupervisorReview())) { | ||
| 509 | + customerCreditHistory.setSupervisorReview(customerCredit.getSupervisorReview()); | ||
| 510 | + } | ||
| 511 | + if (!StringUtil.isBlank(customerCredit.getAnnualTotalSales())) { | ||
| 512 | + customerCreditHistory.setAnnualTotalSales(customerCredit.getAnnualTotalSales()); | ||
| 513 | + } | ||
| 514 | + if (!StringUtil.isBlank(customerCredit.getMainIndustry())) { | ||
| 515 | + customerCreditHistory.setMainIndustry(customerCredit.getMainIndustry()); | ||
| 516 | + } | ||
| 517 | + if (!StringUtil.isBlank(customerCredit.getAnnualMaterialOverview())) { | ||
| 518 | + customerCreditHistory.setAnnualMaterialOverview(customerCredit.getAnnualMaterialOverview()); | ||
| 519 | + } | ||
| 520 | + if (!StringUtil.isBlank(customerCredit.getCompanySettlementPeriod())) { | ||
| 521 | + customerCreditHistory.setCompanySettlementPeriod(customerCredit.getCompanySettlementPeriod()); | ||
| 522 | + } | ||
| 523 | + if (!StringUtil.isBlank(customerCredit.getCompanyCreditLimit())) { | ||
| 524 | + customerCreditHistory.setCompanyCreditLimit(customerCredit.getCompanyCreditLimit()); | ||
| 525 | + } | ||
| 526 | + if (!StringUtil.isBlank(customerCredit.getCompanyMaterialSupplyPlan())) { | ||
| 527 | + customerCreditHistory.setCompanyMaterialSupplyPlan(customerCredit.getCompanyMaterialSupplyPlan()); | ||
| 528 | + } | ||
| 529 | + customerCreditHistory.setCompanySuggestedCategory(customerCredit.getCompanySuggestedCategory()); | ||
| 530 | + customerCreditHistory.setStatus(customerCredit.getStatus()); | ||
| 531 | + return customerCreditHistory; | ||
| 532 | + } | ||
| 533 | + | ||
| 382 | @CacheEvict(value = CustomerCreditHistory.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") | 534 | @CacheEvict(value = CustomerCreditHistory.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") |
| 383 | @Override | 535 | @Override |
| 384 | public void cleanCacheByKey(Serializable key) { | 536 | public void cleanCacheByKey(Serializable key) { |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/customer/CorePersonnelHistoryService.java
| @@ -2,6 +2,7 @@ package com.lframework.xingyun.sc.service.customer; | @@ -2,6 +2,7 @@ package com.lframework.xingyun.sc.service.customer; | ||
| 2 | 2 | ||
| 3 | import com.lframework.starter.web.core.service.BaseMpService; | 3 | import com.lframework.starter.web.core.service.BaseMpService; |
| 4 | import com.lframework.starter.web.core.components.resp.PageResult; | 4 | import com.lframework.starter.web.core.components.resp.PageResult; |
| 5 | +import com.lframework.xingyun.sc.entity.CorePersonnel; | ||
| 5 | import com.lframework.xingyun.sc.entity.CorePersonnelHistory; | 6 | import com.lframework.xingyun.sc.entity.CorePersonnelHistory; |
| 6 | import com.lframework.xingyun.sc.vo.customer.credit.CreateCorePersonnelHistoryVo; | 7 | import com.lframework.xingyun.sc.vo.customer.credit.CreateCorePersonnelHistoryVo; |
| 7 | import com.lframework.xingyun.sc.vo.customer.credit.QueryCorePersonnelHistoryVo; | 8 | import com.lframework.xingyun.sc.vo.customer.credit.QueryCorePersonnelHistoryVo; |
| @@ -46,4 +47,14 @@ public interface CorePersonnelHistoryService extends BaseMpService<CorePersonnel | @@ -46,4 +47,14 @@ public interface CorePersonnelHistoryService extends BaseMpService<CorePersonnel | ||
| 46 | * @return | 47 | * @return |
| 47 | */ | 48 | */ |
| 48 | void deleteById(String id); | 49 | void deleteById(String id); |
| 50 | + | ||
| 51 | + /** | ||
| 52 | + * 更新两个核心人员列表,填充 type 和 xxxChange 字段 | ||
| 53 | + * | ||
| 54 | + * @param beforeList 变更前列表(会被修改:设置 type 和 change 字段) | ||
| 55 | + * @param afterList 变更后列表(会被修改:设置 type 和 change 字段) | ||
| 56 | + */ | ||
| 57 | + void updateWithChangeInfo(List<CorePersonnelHistory> beforeList, List<CorePersonnelHistory> afterList); | ||
| 58 | + | ||
| 59 | + CorePersonnelHistory changeCorePersonnel(CorePersonnel vo); | ||
| 49 | } | 60 | } |
| @@ -3,6 +3,7 @@ package com.lframework.xingyun.sc.service.customer; | @@ -3,6 +3,7 @@ package com.lframework.xingyun.sc.service.customer; | ||
| 3 | import com.lframework.starter.web.core.service.BaseMpService; | 3 | import com.lframework.starter.web.core.service.BaseMpService; |
| 4 | import com.lframework.starter.web.core.components.resp.PageResult; | 4 | import com.lframework.starter.web.core.components.resp.PageResult; |
| 5 | import com.lframework.xingyun.sc.bo.customer.credit.ChangeItem; | 5 | import com.lframework.xingyun.sc.bo.customer.credit.ChangeItem; |
| 6 | +import com.lframework.xingyun.sc.entity.CustomerCredit; | ||
| 6 | import com.lframework.xingyun.sc.entity.CustomerCreditHistory; | 7 | import com.lframework.xingyun.sc.entity.CustomerCreditHistory; |
| 7 | import com.lframework.xingyun.sc.vo.customer.credit.CreateCustomerCreditHistoryVo; | 8 | import com.lframework.xingyun.sc.vo.customer.credit.CreateCustomerCreditHistoryVo; |
| 8 | import com.lframework.xingyun.sc.vo.customer.credit.QueryCustomerCreditHistoryVo; | 9 | import com.lframework.xingyun.sc.vo.customer.credit.QueryCustomerCreditHistoryVo; |
| @@ -53,4 +54,6 @@ public interface CustomerCreditHistoryService extends BaseMpService<CustomerCred | @@ -53,4 +54,6 @@ public interface CustomerCreditHistoryService extends BaseMpService<CustomerCred | ||
| 53 | * 比较两个 CustomerCreditHistory 对象,返回字段变更描述 | 54 | * 比较两个 CustomerCreditHistory 对象,返回字段变更描述 |
| 54 | */ | 55 | */ |
| 55 | List<ChangeItem> getDifferencesWithIndex(CustomerCreditHistory data, CustomerCreditHistory customerCreditHistory); | 56 | List<ChangeItem> getDifferencesWithIndex(CustomerCreditHistory data, CustomerCreditHistory customerCreditHistory); |
| 57 | + | ||
| 58 | + CustomerCreditHistory changeCustomerCredit(CustomerCredit customerCredit); | ||
| 56 | } | 59 | } |