Commit 603c665e by zhaoxiaolei

增加修改特征/特征值后清空缓存功能

parent 8405366c
......@@ -35,7 +35,7 @@ import java.util.List;
@RestController
@RequestMapping("/characteristic")
@Api(tags = {"Characteristic 特征管理"})
//@ApiIgnore
@ApiIgnore
public class CharacteristicController {
......
......@@ -66,7 +66,7 @@ public class IntegrateController {
@PostMapping("/SetSuperTableInfo")
@ApiOperation(value = "集成OD约束关系", notes = "SetSuperTableInfo", httpMethod = "POST")
public CrmResponseEntity<?> SetSuperTableInfo(@RequestBody List<SaveTableInputDto> saveTableInputDtos) {
public CrmResponseEntity<?> setSuperTableInfo(@RequestBody List<SaveTableInputDto> saveTableInputDtos) {
return ResultGenerator.genSuccessResult(integrateService.SetSuperTableInfo(saveTableInputDtos));
}
......@@ -226,7 +226,7 @@ public class IntegrateController {
HttpHeaders headers = getHttpHeader();
preVerifyInputDTO.setProductGroupCode(preVerifyInputDTO.getProductClassCode());
HttpEntity<String> requestEntity = new HttpEntity<String>(JSON.toJSONString(preVerifyInputDTO), headers);
ResponseEntity<String> responseEntity = restTemplate.exchange("http://127.0.0.1:8080/api/v1/selector/preVerify", HttpMethod.POST, requestEntity, String.class);
ResponseEntity<String> responseEntity = restTemplate.exchange(selectorUrl+"/preVerify", HttpMethod.POST, requestEntity, String.class);
JSONObject object = JSONObject.parseObject(responseEntity.getBody());
PreVerifyOutputDTO preVerifyOutputDTO = JSON.toJavaObject((JSON) object.get("data"), PreVerifyOutputDTO.class);
......@@ -241,7 +241,7 @@ public class IntegrateController {
activeValue.setCharacteristicName(characteristic.getCharacteristicName());
List<String> values2 = activeValue.getValues();
for (int i = 0; i < values2.size(); i++) {
String name = integrateService.getName(values2.get(i));
String name = integrateService.getName(values2.get(i),preVerifyInputDTO.getMaterialCode());
values2.add(name);
values2.remove(i);
}
......@@ -262,7 +262,7 @@ public class IntegrateController {
postVerifyInputDTO.setProductGroupCode(postVerifyInputDTO.getProductClassCode());
postVerifyInputDTO.setMaterialCode(postVerifyInputDTO.getSuperBomCode());
HttpEntity<String> requestEntity = new HttpEntity<String>(JSON.toJSONString(postVerifyInputDTO), headers);
ResponseEntity<String> responseEntity = restTemplate.exchange("http://127.0.0.1:8080/api/v1/selector/postVerify", HttpMethod.POST, requestEntity, String.class);
ResponseEntity<String> responseEntity = restTemplate.exchange(selectorUrl+"/postVerify", HttpMethod.POST, requestEntity, String.class);
JSONObject object = JSONObject.parseObject(responseEntity.getBody());
return object.get("data");
}
......@@ -304,27 +304,32 @@ public class IntegrateController {
}
@PostMapping("/GetConfigBySUKINFO")
@ApiOperation(value = "SKU配置接口CRM", notes = "GetConfigBySUKINFO", httpMethod = "POST")
public CrmResponseEntity<?> GetConfigBySUKINFO(@RequestBody SuperBomSkuInfo superBomSkuInfo,HttpServletRequest request){
@ApiOperation(value = "CRM-SKU配置接口", notes = "GetConfigBySUKINFO", httpMethod = "POST")
public CrmResponseEntity<?> getConfigBySUKINFO(@RequestBody SuperBomSkuInfo superBomSkuInfo,HttpServletRequest request){
superBomSkuInfo.setApplyUser(request.getHeader("UserCode"));
return ResultGenerator.genSuccessResult(integrateService.GetConfigBySUKINFO(superBomSkuInfo,request));
}
@PostMapping("/GetSKUByConfigInfo")
@ApiOperation(value = "撞配", notes = "GetSKUByConfigInfo", httpMethod = "POST")
public CrmResponseEntity<?> GetSKUByConfigInfo(@RequestBody SuperBomSkuInfo superBomSkuInfo,HttpServletRequest request){
public CrmResponseEntity<?> getSKUByConfigInfo(@RequestBody SuperBomSkuInfo superBomSkuInfo,HttpServletRequest request){
superBomSkuInfo.setApplyUser(request.getHeader("UserCode"));
return ResultGenerator.genSuccessResult(integrateService.GetSKUByConfigInfo(superBomSkuInfo,request,0));
}
@PostMapping("/GetSKUByH3CConfigInfo")
@ApiOperation(value = "SKU配置接口H3C", notes = "GetSKUByH3CConfigInfo", httpMethod = "POST")
public CrmResponseEntity<?> GetSKUByH3CConfigInfo(@RequestBody GetSKUByH3CConfigInfo configSkuInfo,HttpServletRequest request){
@ApiOperation(value = "H3C-SKU配置接口", notes = "GetSKUByH3CConfigInfo", httpMethod = "POST")
public CrmResponseEntity<?> getSKUByH3CConfigInfo(@RequestBody GetSKUByH3CConfigInfo configSkuInfo,HttpServletRequest request){
return ResultGenerator.genSuccessResult(integrateService.GetSKUByH3CConfigInfo(configSkuInfo,request));
}
@PostMapping("/newGetSKUByH3CConfigInfo")
@ApiOperation(value = "H3C-新SKU配置接口", notes = "GetSKUByH3CConfigInfo", httpMethod = "POST")
public CrmResponseEntity<?> newGetSKUByH3CConfigInfo(@RequestBody GetSKUByH3CConfigInfo configSkuInfo,HttpServletRequest request){
return ResultGenerator.genSuccessResult(integrateService.newGetSKUByH3CConfigInfo(configSkuInfo,request));
}
@PostMapping("/saveSukInfo")
@ApiOperation(value = "保存Sku信息CPQ", notes = "applySukCode", httpMethod = "POST")
@ApiOperation(value = "CPQ-保存Sku信息", notes = "applySukCode", httpMethod = "POST")
public CrmResponseEntity<?> saveSukInfo(@RequestBody SuperBomSkuInfo superBomSkuInfo,HttpServletRequest request){
superBomSkuInfo.setApplyUser(request.getHeader("UserCode"));
return ResultGenerator.genSuccessResult(integrateService.saveSukInfo(superBomSkuInfo,request));
......
......@@ -28,7 +28,7 @@ import java.util.Map;
@RestController
@RequestMapping("/superBom")
@Api(tags = {"部件产品价格系数维护"})
//@ApiIgnore
@ApiIgnore
public class SuperBomPriceCalculateController {
@Resource
......
......@@ -95,7 +95,7 @@ public interface CharacteristicValueMapper extends IBaseMapper<CharacteristicVal
CharacteristicValue findByCharacteristicValueName(String characteristicName,String characteristicValueName,String superBomCode);
String getName(Object v);
String getName(String v,String superBomCode);
String getVNameByCode(String characteristicValueCode,String characteristicCode);
......
......@@ -23,14 +23,14 @@ public interface StandardModelManageMapper extends IBaseMapper<Characteristic>{
List<Characteristic> getStandardModel(StandardModelManageDto standardModelManageDto);
/**
* 修改特征的默认值为0
* @param characteristi
* 修改特征的默认值为0
* @param
* @return 行数
*/
void updateDefaultValueZero(@Param("list") List<String> characteristi,@Param("superBomCode") String superBomCode);
void updateDefaultValueZero(@Param("superBomCode") String superBomCode);
/**
* 修改特征的默认值为1
* 修改特征的默认值为1
* @param characteristiValue
* @return 行数
*/
......
......@@ -24,12 +24,14 @@ public interface IntegrateService {
CharacteristicValue findByCharacteristicValueName(String characteristicName,String characteristicValueName,String superBomCode);
String getName(Object v);
String getName(String v,String superBomCode);
Object getSuperBomInfoByConfigId(Map<String, Object> map);
Object GetSKUByH3CConfigInfo(GetSKUByH3CConfigInfo configSkuInfo,HttpServletRequest request);
Object newGetSKUByH3CConfigInfo(GetSKUByH3CConfigInfo configSkuInfo,HttpServletRequest request);
Object getConfigInfo(GetConfigurationInputDTO getConfigurationInputDTO);
Object saveSukInfo(SuperBomSkuInfo superBomSkuInfo,HttpServletRequest request);
......@@ -53,4 +55,6 @@ public interface IntegrateService {
Object ldapAuth(UserInfo userinfo);
void saveUserOperationLog(HttpServletRequest request, UserOperationLog log);
void cleanRedisData(String superBomCode,String productClassCode);
}
......@@ -2,16 +2,17 @@ package cn.com.uitech.authorization.service.impl;
import cn.com.uitech.authorization.exception.BizException;
import cn.com.uitech.authorization.mapper.CharacteristicMapper;
import cn.com.uitech.authorization.mapper.CtoBomMapper;
import cn.com.uitech.authorization.mapper.SuperBomPriceCalculateMapper;
import cn.com.uitech.authorization.pojo.dto.CharacteristicExportDto;
import cn.com.uitech.authorization.pojo.dto.CharacteristicLogOpera;
import cn.com.uitech.authorization.pojo.dto.CharacteristicRequestParamDto;
import cn.com.uitech.authorization.pojo.dto.GetProductOutDto;
import cn.com.uitech.authorization.pojo.entity.Characteristic;
import cn.com.uitech.authorization.pojo.entity.ConfigurableBom;
import cn.com.uitech.authorization.service.CharacteristicService;
import cn.com.uitech.authorization.service.CtoBomService;
import cn.com.uitech.authorization.service.IntegrateService;
import cn.com.uitech.authorization.utils.ApiResult;
import cn.com.uitech.authorization.utils.DateUitl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
......@@ -38,7 +39,10 @@ import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* @author yangkuo
......@@ -55,7 +59,10 @@ public class CharacteristicServiceImpl implements CharacteristicService {
private SuperBomPriceCalculateMapper superBomPriceCalculateMapper;
@Autowired
private CtoBomService ctoBomService;
private IntegrateService integrateService;
@Autowired
private CtoBomMapper ctoBomMapper;
/**
* 分页查询特征列表
......@@ -84,6 +91,10 @@ public class CharacteristicServiceImpl implements CharacteristicService {
logOpera.setOpera("/characteristic/update");
characteristicMapper.saveLogOpera(logOpera);
requestParamDto.setUpdateUser(request.getHeader("UserCode"));
//清空缓存
String superBomCode = requestParamDto.getSuperBomCode();
ConfigurableBom cto = ctoBomMapper.getCto(superBomCode);
integrateService.cleanRedisData(superBomCode,cto.getProductClassCode());
return characteristicMapper.updateCharacteristic(requestParamDto);
}
......@@ -381,6 +392,12 @@ public class CharacteristicServiceImpl implements CharacteristicService {
info.setUpdateUser(request.getHeader("UserCode"));
characteristicMapper.updateCharacteristicInfo(info);
}
if(!CollectionUtils.isEmpty(updateList)){
//清空缓存
String superBomCode = updateList.get(0).getSuperBomCode();
ConfigurableBom cto = ctoBomMapper.getCto(superBomCode);
integrateService.cleanRedisData(superBomCode,cto.getProductClassCode());
}
}
/**
......
......@@ -2,11 +2,14 @@ package cn.com.uitech.authorization.service.impl;
import cn.com.uitech.authorization.exception.BizException;
import cn.com.uitech.authorization.mapper.CharacteristicValueMapper;
import cn.com.uitech.authorization.mapper.CtoBomMapper;
import cn.com.uitech.authorization.mapper.SuperBomPriceCalculateMapper;
import cn.com.uitech.authorization.pojo.dto.*;
import cn.com.uitech.authorization.pojo.entity.CharacteristicValue;
import cn.com.uitech.authorization.pojo.entity.ConfigurableBom;
import cn.com.uitech.authorization.pojo.entity.OdRelation;
import cn.com.uitech.authorization.service.CharacteristicValueService;
import cn.com.uitech.authorization.service.IntegrateService;
import cn.com.uitech.authorization.utils.ApiResult;
import cn.com.uitech.authorization.utils.DateUitl;
import com.alibaba.fastjson.JSON;
......@@ -72,6 +75,13 @@ public class CharacteristicValueServiceImpl implements CharacteristicValueServic
private String plmUrlH;
@Autowired
private IntegrateService integrateService;
@Autowired
private CtoBomMapper ctoBomMapper;
/**
* 分页查询特征值数据
*
......@@ -110,6 +120,7 @@ public class CharacteristicValueServiceImpl implements CharacteristicValueServic
@Override
public Integer batchModifyBomStatus(CharacteristicValueRequestParamDto dto,HttpServletRequest request) {
List<Map<String, String>> characteristicValueCodes = dto.getCharacteristicValueCodes();
List<String> superBomCodes = new ArrayList<String>();
characteristicValueCodes.forEach(item->{
CharacteristicValue characteristicValue = characteristicValueMapper.getVByCode(item.get("characteristicValueCode"), item.get("superBomCode"));
CharacteristicValueLogOpera logOpera = new CharacteristicValueLogOpera();
......@@ -119,7 +130,16 @@ public class CharacteristicValueServiceImpl implements CharacteristicValueServic
characteristicValueMapper.saveLogOpera(logOpera);
dto.setUpdateUser(request.getHeader("UserCode"));
characteristicValueMapper.batchModifyBomStatus(item.get("characteristicValueCode"), item.get("superBomCode"),dto.getIsState(),request.getHeader("UserCode"));
superBomCodes.remove(item.get("characteristicValueCode")+"--"+item.get("superBomCode"));
superBomCodes.add(item.get("characteristicValueCode")+"--"+item.get("superBomCode"));
});
if(!CollectionUtils.isEmpty(superBomCodes)){
superBomCodes.forEach(item->{
//清空缓存
String[] split = item.split("--");
integrateService.cleanRedisData(split[0],split[1]);
});
}
return null;
}
......@@ -179,6 +199,10 @@ public class CharacteristicValueServiceImpl implements CharacteristicValueServic
logOpera.setOpera("/characteristicValue/editCharacteristicValue");
characteristicValueMapper.saveLogOpera(logOpera);
dto.setUpdateUser(request.getHeader("UserCode"));
//清空缓存
String superBomCode = dto.getSuperBomCode();
ConfigurableBom cto = ctoBomMapper.getCto(superBomCode);
integrateService.cleanRedisData(superBomCode,cto.getProductClassCode());
return characteristicValueMapper.editCharacteristicValue(dto);
}
}
......@@ -524,6 +548,12 @@ public class CharacteristicValueServiceImpl implements CharacteristicValueServic
v.setUpdateUser(request.getHeader("UserCode"));
characteristicValueMapper.updateCharacteristicValue(v);
}
if(!CollectionUtils.isEmpty(updateList)){
//清空缓存
String superBomCode = updateList.get(0).getSuperBomCode();
ConfigurableBom cto = ctoBomMapper.getCto(superBomCode);
integrateService.cleanRedisData(superBomCode,cto.getProductClassCode());
}
}
;
......
......@@ -88,8 +88,8 @@ public class StandardModelManageServiceImpl implements StandardModelManageServic
}else {
throw new BizException(ApiResult.API_REQ_DATA_IS_FAIL);
}
//根据特征编码把下面所有的特征值更行成0非默认
standardModelManageMapper.updateDefaultValueZero(characteristi,dto.getSuperBomCode());
//根据superBom把下面所有的特征值更行成0非默认
standardModelManageMapper.updateDefaultValueZero(dto.getSuperBomCode());
//根据特征值编码把特征值更新为1 默认选中
standardModelManageMapper.updateDefaultValueOne(characteristiValue,dto.getSuperBomCode());
//更新cto的configId
......
......@@ -311,9 +311,8 @@
select characteristic_value_name
from super_table_item_info a
left join super_characteristic_value_info b
on a.characteristic_value_code = b.characteristic_value_code
where b.characteristic_value_code = #{v}
group by b.characteristic_value_name
on a.characteristic_value_code = b.characteristic_value_code and b.super_bom_code = a.super_bom_code
where b.characteristic_value_name = #{v} and b.super_bom_code = #{superBomCode}
</select>
<select id="getVNameByCode" resultType="java.lang.String">
......@@ -356,7 +355,10 @@
h3c_Deliver_Code = #{h3cDeliverCode},
update_time = now(),
update_user = #{updateUser}
where super_bom_code = #{superBomCode} and characteristic_Code = #{characteristicCode} and characteristic_Value_Code = #{characteristicValueCode}
where
super_bom_code = #{superBomCode}
and characteristic_Code = #{characteristicCode}
and characteristic_Value_Code = #{characteristicValueCode}
</update>
<insert id="saveLogOpera">
......
......@@ -45,17 +45,11 @@
</update>
<!--根据特征值编码把所有特征值更新为默认1-->
<!--根据特征值编码把所有特征值更新为默认0-->
<update id="updateDefaultValueZero" >
UPDATE super_characteristic_info
SET is_Show=1
UPDATE super_characteristic_value_info
SET is_base=0
<where>
<if test="list!=null and list.size()>0">
and characteristic_Code in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="superBomCode !=null and superBomCode !='' ">
and super_bom_code = #{superBomCode}
</if>
......
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