|
@@ -63,6 +63,8 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
|
@Resource
|
|
|
private ActionLogMapper actionLogMapper;
|
|
|
@Resource
|
|
|
+ private BusinessItemProductMapper bipMapper;
|
|
|
+ @Resource
|
|
|
private UserMapper userMapper;
|
|
|
@Resource
|
|
|
private BusinessItemProductMapper biMapper;
|
|
@@ -91,7 +93,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
|
businessOpportunity.setActionLogList(actionLogMapper.selectList(new QueryWrapper<ActionLog>().eq("item_id", bo.getId()).eq("code", "business")));
|
|
|
businessOpportunity.setUploadFilePList(uploadFileMapper.selectByInfoList("business",bo.getId()));
|
|
|
businessOpportunity.setTaskList(taskMapper.selectList(new QueryWrapper<Task>().eq("business_opportunity_id",bo.getId())));
|
|
|
- List<BusinessItemProduct> businessItemProducts = biMapper.selectListToBoId(bo.getId());
|
|
|
+ List<BusinessItemProduct> businessItemProducts = bipMapper.selectList(new QueryWrapper<BusinessItemProduct>().eq("business_id", bo.getId()));
|
|
|
if (businessItemProducts.size() > 0){
|
|
|
BigDecimal finalPrice = new BigDecimal(0);
|
|
|
BigDecimal discountedPrice = new BigDecimal(0);
|
|
@@ -140,7 +142,10 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
|
bo.setCreateTime(new Date());
|
|
|
bOMapper.insert(bo);
|
|
|
List<BusinessItemProduct> businessItemProducts = JSONArray.parseArray(bo.getBusinessItemProductList(), BusinessItemProduct.class);
|
|
|
- System.out.println(businessItemProducts);
|
|
|
+ for (BusinessItemProduct businessItemProduct : businessItemProducts) {
|
|
|
+ businessItemProduct.setBusinessId(bo.getId());
|
|
|
+ bipMapper.insert(businessItemProduct);
|
|
|
+ }
|
|
|
ActionLog actionLog = new ActionLog();
|
|
|
actionLog.setUserId(bo.getUserId());
|
|
|
actionLog.setItemId(bo.getId());
|
|
@@ -154,6 +159,12 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
|
public void update(BusinessOpportunity bo, String userId) {
|
|
|
setNull(bo);
|
|
|
bOMapper.updateById(bo);
|
|
|
+ bipMapper.delete(new QueryWrapper<BusinessItemProduct>().eq("business_id",bo.getId()));
|
|
|
+ List<BusinessItemProduct> businessItemProducts = JSONArray.parseArray(bo.getBusinessItemProductList(), BusinessItemProduct.class);
|
|
|
+ for (BusinessItemProduct businessItemProduct : businessItemProducts) {
|
|
|
+ businessItemProduct.setBusinessId(bo.getId());
|
|
|
+ bipMapper.insert(businessItemProduct);
|
|
|
+ }
|
|
|
ActionLog log = new ActionLog();
|
|
|
log.setItemId(bo.getId());
|
|
|
log.setName("编辑了商机");
|
|
@@ -552,6 +563,17 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
|
return msg;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void saveContactsId(BusinessOpportunity bo, User user) {
|
|
|
+ bOMapper.update(bo, new UpdateWrapper<BusinessOpportunity>().eq("id", bo.getId()).set("contacts_id", bo.getContactsId()));
|
|
|
+ ActionLog al = new ActionLog();
|
|
|
+ al.setCode("business");
|
|
|
+ al.setName("关联了联系人");
|
|
|
+ al.setUserId(user.getId());
|
|
|
+ al.setItemId(bo.getId());
|
|
|
+ actionLogMapper.insert(al);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
private BusinessOpportunity setNull(BusinessOpportunity bo) {
|