Commit 08e6ebd7 by 叶立庆

Merge branch 'v5.8.5' into 'master'

上线合并

See merge request !4
2 parents 715c2a63 7ae85dbf
package cn.com.glsx.dj.oaapproval.mapper.old;
import cn.com.glsx.dj.smartcarlife.model.ServiceMerchant;
import org.apache.ibatis.annotations.Mapper;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
@Mapper
public interface ServiceMerchantMapper extends OreMapper<ServiceMerchant> {
}
......@@ -6,6 +6,7 @@ import cn.com.glsx.dj.oaapproval.mapper.StoreApproveSceneMapper;
import cn.com.glsx.dj.oaapproval.mapper.StoreCreateBusinessApproveMapper;
import cn.com.glsx.dj.oaapproval.mapper.old.*;
import cn.com.glsx.dj.oaapproval.model.store.*;
import cn.com.glsx.dj.smartcarlife.constant.CommonConstants;
import cn.com.glsx.dj.smartcarlife.dto.ExpenseCategoryDTO;
import cn.com.glsx.dj.smartcarlife.enums.*;
import cn.com.glsx.dj.smartcarlife.model.*;
......@@ -104,6 +105,9 @@ public class StoreAppRulePublishService {
@Autowired
private SmartcarSceneMerchantRefNewMapper smartcarSceneMerchantRefNewMapper;
@Autowired
private ServiceMerchantMapper serviceMerchantMapper;
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class)
public void publishApprovedData(String businessCode, String updatedBy,Date now) {
RpcAssert.assertNotEmpty(businessCode, DefaultErrorEnum.DATA_NULL, "businessCode is null");
......@@ -987,6 +991,36 @@ public class StoreAppRulePublishService {
List<Integer> mainMerchantIdList = context.merchantRefs.stream()
.map(StoreAppMerchantRef::getMerchantId).collect(Collectors.toList());
smartcarSceneMerchantRefNewMapper.updateOprTime(mainMerchantIdList, context.updatedBy, context.baseSceneCode);
// 如果是精品升级场景,需要更新精品升级场景的字段
if(context.baseSceneCode != null && context.baseSceneCode.equals(BaseSceneEnum.QUALITY_UPGRADE.getBaseSceneCode())){
for (Integer merchantId: mainMerchantIdList) {
updateServiceMerchantOpenDate(merchantId, new Date());
}
}
}
@Transactional(propagation= Propagation.REQUIRED,rollbackFor=RpcServiceException.class)
public void updateServiceMerchantOpenDate(Integer merchantId, Date openDate){
ServiceMerchant sm = getBaseByMerchantId(merchantId);
if(sm != null && sm.getOpenDate() == null) {
ServiceMerchant updatedRecord = ServiceMerchant.builder().id(sm.getId()).openDate(openDate)
.updatedDate(new Date()).updatedBy(CommonConstants.DEFAULT_UPDATE_BY).build();
serviceMerchantMapper.updateByPrimaryKeySelective(updatedRecord);
}
}
@Transactional(propagation= Propagation.REQUIRED,rollbackFor=RpcServiceException.class)
public ServiceMerchant getBaseByMerchantId(Integer merchantId){
RpcAssert.assertNotNull(merchantId, DefaultErrorEnum.DATA_NULL,"merchantId not be null");
try{
ServiceMerchant condition = new ServiceMerchant();
condition.setMerchantId(merchantId);
condition.setDeletedFlag(DeletedFlagEnum.N.name());
return serviceMerchantMapper.selectOne(condition);
}catch(Exception e){
log.info(e.getMessage(),e);
throw new RpcServiceException(DefaultErrorEnum.DATABASE_ERROR,e.getMessage());
}
}
private MerchantTarget resolveDistributionTarget(StoreAppMerchantRef merchantRef, StoreAppDistributionRule distribution,ApprovalPublishContext context) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!