Commit f8cf0346 authored by tianyiming's avatar tianyiming

添加使用登记证编号和设备代码校验

parent f4a6ddcf
...@@ -33,4 +33,10 @@ public interface CategoryOtherInfoMapper extends BaseMapper<CategoryOtherInfo> { ...@@ -33,4 +33,10 @@ public interface CategoryOtherInfoMapper extends BaseMapper<CategoryOtherInfo> {
CategoryOtherInfo queryInitCode(@Param("initCode") @NonNull String initCode); CategoryOtherInfo queryInitCode(@Param("initCode") @NonNull String initCode);
void updateEsStatus(String id); void updateEsStatus(String id);
Map<String, Long> checkCode(@Param("type") String type,
@Param("code96333") String code96333,
@Param("equCode") String equCode,
@Param("useOrgCode") String useOrgCode,
@Param("record") String record);
} }
...@@ -30,7 +30,7 @@ public interface IEquipmentCategoryService { ...@@ -30,7 +30,7 @@ public interface IEquipmentCategoryService {
Map<String,Object> getCategoryAndDefineByRecord(String rowId); Map<String,Object> getCategoryAndDefineByRecord(String rowId);
List<CategoryOtherInfo> checkCode(Map<String, Object> obj); String checkCode(Map<String, Object> obj);
List<String> updateOtherInfo(Map<String, Object> map); List<String> updateOtherInfo(Map<String, Object> map);
......
...@@ -99,4 +99,29 @@ ...@@ -99,4 +99,29 @@
SET "IS_NOT_ES" = '1' SET "IS_NOT_ES" = '1'
WHERE "RECORD" = #{id} WHERE "RECORD" = #{id}
</update> </update>
<select id="checkCode" resultType="java.util.Map">
SELECT
<if test="equCode != null and equCode != ''">
(SELECT COUNT ( 1 ) FROM idx_biz_jg_register_info ibjri WHERE ibjri."EQU_CODE" = #{equCode}
<if test="type != 'save' ">
and ibjri."RECORD" != #{record}
</if>
) AS equCode,
</if>
<if test="useOrgCode != null and useOrgCode != ''">
(SELECT COUNT ( 1 ) FROM idx_biz_jg_register_info ibjri WHERE ibjri."USE_ORG_CODE" = #{useOrgCode}
<if test="type != 'save'">
and ibjri."RECORD" != #{record}
</if>
) AS useOrgCode,
</if>
<if test="code96333 != null and code96333 != ''">
(SELECT COUNT ( 1 ) FROM idx_biz_jg_other_info ibjoi WHERE ibjoi."CODE96333" = #{code96333}
<if test="type != 'save'">
and ibjoi."RECORD" != #{record}
</if>
) AS code
</if>
</select>
</mapper> </mapper>
...@@ -235,17 +235,17 @@ public class EquipmentCategoryController extends BaseController { ...@@ -235,17 +235,17 @@ public class EquipmentCategoryController extends BaseController {
return ResponseHelper.buildResponse(equipmentCategoryService.getFormRecordById(map)); return ResponseHelper.buildResponse(equipmentCategoryService.getFormRecordById(map));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/checkCode", method = RequestMethod.POST) @RequestMapping(value = "/checkCode", method = RequestMethod.POST)
@ApiOperation(httpMethod = "post", value = "校验96333码", notes = "校验96333码") @ApiOperation(httpMethod = "post", value = "校验使用登记证编号、设备代码、96333码重复", notes = "校验使用登记证编号、设备代码、96333码重复")
public ResponseModel<Object> checkCode(@RequestBody Map<String,Object> obj){ public ResponseModel<Object> checkCode(@RequestBody Map<String,Object> obj){
List<CategoryOtherInfo> categoryOtherInfos = equipmentCategoryService.checkCode(obj); String message = equipmentCategoryService.checkCode(obj);
if(categoryOtherInfos.size() == 0){ if(ObjectUtils.isEmpty(message)){
return ResponseHelper.buildResponse(categoryOtherInfos); return ResponseHelper.buildResponse(true);
} else { } else {
ResponseModel<Object> response = new ResponseModel(); ResponseModel<Object> response = new ResponseModel();
response.setResult(null); response.setResult(null);
response.setMessage("96333码重复,请确认数据是否输入正确,或联系管辖机构处理。"); response.setMessage(message);
response.setStatus(HttpStatus.BAD_REQUEST.value()); response.setStatus(HttpStatus.BAD_REQUEST.value());
return response; return response;
} }
......
...@@ -25,17 +25,9 @@ import com.yeejoin.amos.boot.module.ymt.flc.api.feign.PrivilegeFeginService; ...@@ -25,17 +25,9 @@ import com.yeejoin.amos.boot.module.ymt.flc.api.feign.PrivilegeFeginService;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.CompanyModel; import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
...@@ -85,10 +77,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -85,10 +77,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
private SuperviseInfoMapper superviseInfoMapper; private SuperviseInfoMapper superviseInfoMapper;
@Autowired @Autowired
private UseInfoMapper useInfoMapper;
@Autowired
EquipmentCategoryMapper equipmentCategoryMapper; EquipmentCategoryMapper equipmentCategoryMapper;
@Value("classpath:/json/equipCategory.json") @Value("classpath:/json/equipCategory.json")
...@@ -418,14 +406,22 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -418,14 +406,22 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
} }
@Override @Override
public List<CategoryOtherInfo> checkCode(Map<String, Object> obj) { public String checkCode(Map<String, Object> obj) {
List<CategoryOtherInfo> codeList; String result = null;
if ("save".equals(obj.get("type"))) { String type = (String) obj.get("type");
codeList = categoryOtherInfoMapper.selectList(new QueryWrapper<CategoryOtherInfo>().eq("CODE96333", obj.get("CODE96333")).eq("CLAIM_STATUS", EquipmentCategoryEnum.YRL.getName())); String code96333 = String.valueOf(obj.get("CODE96333"));
} else { String equCode = (String) obj.get("EQU_CODE");
codeList = categoryOtherInfoMapper.selectList(new QueryWrapper<CategoryOtherInfo>().ne("RECORD", obj.get("id")).eq("CODE96333", obj.get("CODE96333")).eq("CLAIM_STATUS", EquipmentCategoryEnum.YRL.getName())); String useOrgCode = (String) obj.get("USE_ORG_CODE");
String record = (String) obj.get("id");
Map<String, Long> map = categoryOtherInfoMapper.checkCode(type, code96333, equCode, useOrgCode, record);
if(map.containsKey("equCode") && map.get("equCode") > 0){
result = "设备代码重复,请确认数据是否输入正确,或联系管辖机构处理。";
} else if (map.containsKey("useOrgCode") && map.get("useOrgCode") > 0){
result = "使用登记证编号重复,请确认数据是否输入正确,或联系管辖机构处理。";
} else if (map.containsKey("code") && map.get("code") > 0){
result = "96333码重复,请确认数据是否输入正确,或联系管辖机构处理。";
} }
return codeList; return result;
} }
@Override @Override
......
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