新增第三方产品信息上传审核,中继服务同步问题,定时任务问题
parent
374cfda8aa
commit
80b19f4cea
@ -0,0 +1,129 @@
|
||||
package com.glxp.api.admin.controller.basic;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.glxp.api.admin.dao.basic.BasicThirdSysDao;
|
||||
import com.glxp.api.admin.entity.basic.BasicThirdSysEntity;
|
||||
import com.glxp.api.admin.entity.basic.CorpImportLogEntity;
|
||||
import com.glxp.api.admin.entity.basic.NewUploadDiEntity;
|
||||
import com.glxp.api.admin.entity.thrsys.ThrProductsEntity;
|
||||
import com.glxp.api.admin.req.basic.FilterNewUploadDiRequest;
|
||||
import com.glxp.api.admin.req.basic.FilterUdiIpLogRequest;
|
||||
import com.glxp.api.admin.req.inout.DeleteRequest;
|
||||
import com.glxp.api.admin.res.PageSimpleResponse;
|
||||
import com.glxp.api.admin.res.basic.NewUploadDiResponse;
|
||||
import com.glxp.api.admin.res.basic.UdiRelevanceResponse;
|
||||
import com.glxp.api.admin.service.basic.NewUploadDiService;
|
||||
import com.glxp.api.admin.service.basic.UdiRelevanceService;
|
||||
import com.glxp.api.admin.util.HttpOkClient;
|
||||
import com.glxp.api.common.enums.ResultEnum;
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.common.util.ResultVOUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
public class NewUploadDiController {
|
||||
|
||||
@Resource
|
||||
NewUploadDiService newUploadDiService;
|
||||
@Resource
|
||||
UdiRelevanceService udiRelevanceService;
|
||||
@Resource
|
||||
HttpOkClient httpOkClient;
|
||||
@Resource
|
||||
private BasicThirdSysDao basicThirdSysDao;
|
||||
|
||||
@PostMapping("/udiwms/basic/newDi/postThird")
|
||||
public BaseResponse postThird(@RequestBody NewUploadDiEntity newUploadDiEntity, BindingResult bindingResult) {
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
|
||||
ThrProductsEntity thrProductsEntity = new ThrProductsEntity();
|
||||
UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectGroupById(newUploadDiEntity.getRelId());
|
||||
BeanUtils.copyProperties(udiRelevanceResponse, thrProductsEntity);
|
||||
thrProductsEntity.setStandard(udiRelevanceResponse.getGgxh());
|
||||
thrProductsEntity.setSpec(udiRelevanceResponse.getGgxh());
|
||||
thrProductsEntity.setName(udiRelevanceResponse.getCpmctymc());
|
||||
thrProductsEntity.setRegisterNo(udiRelevanceResponse.getZczbhhzbapzbh());
|
||||
BasicThirdSysEntity basicThirdSysEntity = basicThirdSysDao.selectByThirdId(newUploadDiEntity.getThirdSysFk());
|
||||
String response = httpOkClient.uCloudPost(basicThirdSysEntity.getThridUrl() + "/udiwms/erp/post/product", thrProductsEntity);
|
||||
if (StrUtil.isEmpty(response)) {
|
||||
newUploadDiEntity.setUploadStatus(2);
|
||||
newUploadDiEntity.setUploadMsg("提交失败!");
|
||||
return ResultVOUtils.error(500, "提交失败!");
|
||||
}
|
||||
try {
|
||||
BaseResponse baseResponse = JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
|
||||
});
|
||||
if (baseResponse.getCode().equals(20000)) {
|
||||
newUploadDiEntity.setUploadStatus(3);
|
||||
newUploadDiEntity.setUploadMsg("上传成功!");
|
||||
newUploadDiService.updateNewUploadDi(newUploadDiEntity);
|
||||
return ResultVOUtils.success("上传成功!");
|
||||
} else {
|
||||
newUploadDiEntity.setUploadStatus(2);
|
||||
newUploadDiEntity.setUploadMsg("提交失败,异常信息:" + baseResponse.getMessage());
|
||||
newUploadDiService.updateNewUploadDi(newUploadDiEntity);
|
||||
return ResultVOUtils.error(500, "提交失败,异常信息:" + baseResponse.getMessage());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
newUploadDiEntity.setUploadStatus(2);
|
||||
newUploadDiEntity.setUploadMsg("提交失败,异常信息:" + e.getMessage());
|
||||
newUploadDiService.updateNewUploadDi(newUploadDiEntity);
|
||||
return ResultVOUtils.error(500, "提交失败,异常信息:" + e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/udiwms/basic/newDi/filter")
|
||||
public BaseResponse filter(FilterNewUploadDiRequest filterNewUploadDiRequest,
|
||||
BindingResult bindingResult) {
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
List<NewUploadDiResponse> newUploadDiEntities
|
||||
= newUploadDiService.filterJoinNewUploads(filterNewUploadDiRequest);
|
||||
PageInfo<NewUploadDiResponse> pageInfo;
|
||||
pageInfo = new PageInfo<>(newUploadDiEntities);
|
||||
PageSimpleResponse<NewUploadDiResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
||||
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||
pageSimpleResponse.setList(newUploadDiEntities);
|
||||
return ResultVOUtils.success(pageSimpleResponse);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/udiwms/basic/newDi/delete")
|
||||
public BaseResponse delete(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) {
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
|
||||
if (StrUtil.isEmpty(deleteRequest.getId())) {
|
||||
return ResultVOUtils.error(500, "删除失败!");
|
||||
}
|
||||
boolean b = newUploadDiService.deleteById(Integer.parseInt(deleteRequest.getId()));
|
||||
if (b) {
|
||||
return ResultVOUtils.success("删除成功!");
|
||||
} else {
|
||||
return ResultVOUtils.error(500, "删除失败!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.glxp.api.admin.dao.basic;
|
||||
|
||||
import com.glxp.api.admin.entity.basic.NewUploadDiEntity;
|
||||
import com.glxp.api.admin.req.basic.FilterNewUploadDiRequest;
|
||||
import com.glxp.api.admin.res.basic.NewUploadDiResponse;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface NewUploadDiDao {
|
||||
|
||||
|
||||
List<NewUploadDiResponse> filterJoinNewUploads(FilterNewUploadDiRequest filterNewUploadDiRequest);
|
||||
|
||||
List<NewUploadDiEntity> filterNewUploads(FilterNewUploadDiRequest filterNewUploadDiRequest);
|
||||
|
||||
boolean deleteById(Integer id);
|
||||
|
||||
boolean insertNewUploadDi(NewUploadDiEntity newUploadDiEntity);
|
||||
|
||||
boolean updateNewUploadDi(NewUploadDiEntity newUploadDiEntity);
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.glxp.api.admin.entity.basic;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class NewUploadDiEntity {
|
||||
private Integer id;
|
||||
private String relId;
|
||||
private String thirdSysFk;
|
||||
private Integer uploadStatus;
|
||||
private String uploadMsg;
|
||||
private String uploadCode;
|
||||
private String remark;
|
||||
private Date updateTime;
|
||||
private Date submitTime;
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.glxp.api.admin.req.basic;
|
||||
|
||||
import com.glxp.api.admin.req.ListPageRequest;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FilterNewUploadDiRequest extends ListPageRequest {
|
||||
|
||||
private Integer id;
|
||||
private String relId;
|
||||
private String thirdSysFk;
|
||||
private Integer uploadStatus;
|
||||
private String uploadCode;
|
||||
private String lastUpdateTime;
|
||||
|
||||
private String nameCode;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.glxp.api.admin.res.basic;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class NewUploadDiResponse {
|
||||
|
||||
private Integer id;
|
||||
private String nameCode;
|
||||
private String productName;
|
||||
private String relId;
|
||||
private String thirdSysFk;
|
||||
private Integer uploadStatus;
|
||||
private String uploadMsg;
|
||||
private String uploadCode;
|
||||
private String remark;
|
||||
private Date updateTime;
|
||||
private Date submitTime;
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.glxp.api.admin.service.basic;
|
||||
|
||||
|
||||
import com.glxp.api.admin.entity.basic.NewUploadDiEntity;
|
||||
import com.glxp.api.admin.req.basic.FilterNewUploadDiRequest;
|
||||
import com.glxp.api.admin.res.basic.NewUploadDiResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface NewUploadDiService {
|
||||
List<NewUploadDiResponse> filterJoinNewUploads(FilterNewUploadDiRequest filterNewUploadDiRequest);
|
||||
|
||||
List<NewUploadDiEntity> filterNewUploads(FilterNewUploadDiRequest filterNewUploadDiRequest);
|
||||
|
||||
boolean deleteById(Integer id);
|
||||
|
||||
boolean insertNewUploadDi(NewUploadDiEntity newUploadDiEntity);
|
||||
|
||||
boolean updateNewUploadDi(NewUploadDiEntity newUploadDiEntity);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.glxp.api.admin.service.basic.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.glxp.api.admin.dao.basic.NewUploadDiDao;
|
||||
import com.glxp.api.admin.entity.basic.NewUploadDiEntity;
|
||||
import com.glxp.api.admin.req.basic.FilterNewUploadDiRequest;
|
||||
import com.glxp.api.admin.res.basic.NewUploadDiResponse;
|
||||
import com.glxp.api.admin.service.basic.NewUploadDiService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class NewUploadDiServiceImpl implements NewUploadDiService {
|
||||
@Resource
|
||||
NewUploadDiDao newUploadDiDao;
|
||||
|
||||
@Override
|
||||
public List<NewUploadDiResponse> filterJoinNewUploads(FilterNewUploadDiRequest filterNewUploadDiRequest) {
|
||||
if (filterNewUploadDiRequest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (filterNewUploadDiRequest.getPage() != null) {
|
||||
int offset = (filterNewUploadDiRequest.getPage() - 1) * filterNewUploadDiRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, filterNewUploadDiRequest.getLimit());
|
||||
}
|
||||
List<NewUploadDiResponse> data = newUploadDiDao.filterJoinNewUploads(filterNewUploadDiRequest);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NewUploadDiEntity> filterNewUploads(FilterNewUploadDiRequest filterNewUploadDiRequest) {
|
||||
|
||||
if (filterNewUploadDiRequest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (filterNewUploadDiRequest.getPage() != null) {
|
||||
int offset = (filterNewUploadDiRequest.getPage() - 1) * filterNewUploadDiRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, filterNewUploadDiRequest.getLimit());
|
||||
}
|
||||
List<NewUploadDiEntity> data = newUploadDiDao.filterNewUploads(filterNewUploadDiRequest);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteById(Integer id) {
|
||||
return newUploadDiDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertNewUploadDi(NewUploadDiEntity newUploadDiEntity) {
|
||||
return newUploadDiDao.insertNewUploadDi(newUploadDiEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateNewUploadDi(NewUploadDiEntity newUploadDiEntity) {
|
||||
return newUploadDiDao.updateNewUploadDi(newUploadDiEntity);
|
||||
}
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
|
||||
<mapper namespace="com.glxp.api.admin.dao.basic.NewUploadDiDao">
|
||||
|
||||
<select id="filterNewUploads" parameterType="com.glxp.api.admin.req.basic.FilterUdiIpLogRequest"
|
||||
resultType="com.glxp.api.admin.entity.basic.NewUploadDiEntity">
|
||||
SELECT * FROM basic_new_udi_upload
|
||||
<where>
|
||||
<if test="id != '' and id != null">
|
||||
AND id = #{id}
|
||||
</if>
|
||||
<if test="relId != '' and relId != null">
|
||||
AND relId = #{relId}
|
||||
</if>
|
||||
<if test="thirdSysFk != '' and thirdSysFk != null">
|
||||
AND thirdSysFk = #{thirdSysFk}
|
||||
</if>
|
||||
<if test="uploadStatus != '' and uploadStatus != null">
|
||||
AND uploadStatus = #{uploadStatus}
|
||||
</if>
|
||||
<if test="uploadCode != '' and uploadCode != null">
|
||||
AND uploadCode = #{uploadCode}
|
||||
</if>
|
||||
<if test="lastUpdateTime!=null and lastUpdateTime!=''">
|
||||
<![CDATA[ and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S')>= DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S') ]]>
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY updateTime DESC
|
||||
</select>
|
||||
|
||||
|
||||
<select id="filterJoinNewUploads" parameterType="com.glxp.api.admin.req.basic.FilterUdiIpLogRequest"
|
||||
resultType="com.glxp.api.admin.res.basic.NewUploadDiResponse">
|
||||
SELECT basic_new_udi_upload.* ,basic_products.nameCode ,basic_products.cpmctymc productName FROM basic_new_udi_upload
|
||||
INNER JOIN basic_udirel on basic_new_udi_upload.relId = basic_udirel.id
|
||||
INNER JOIN basic_products on basic_udirel.uuid = basic_products.uuid
|
||||
<where>
|
||||
<if test="id != '' and id != null">
|
||||
AND id = #{id}
|
||||
</if>
|
||||
<if test="relId != '' and relId != null">
|
||||
AND relId = #{relId}
|
||||
</if>
|
||||
<if test="thirdSysFk != '' and thirdSysFk != null">
|
||||
AND thirdSysFk = #{thirdSysFk}
|
||||
</if>
|
||||
<if test="uploadStatus != '' and uploadStatus != null">
|
||||
AND uploadStatus = #{uploadStatus}
|
||||
</if>
|
||||
<if test="uploadCode != '' and uploadCode != null">
|
||||
AND uploadCode = #{uploadCode}
|
||||
</if>
|
||||
<if test="lastUpdateTime!=null and lastUpdateTime!=''">
|
||||
<![CDATA[ and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S')>= DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S') ]]>
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY updateTime DESC
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertNewUploadDi" keyProperty="id" parameterType="com.glxp.api.admin.entity.basic.NewUploadDiEntity">
|
||||
replace
|
||||
INTO basic_new_udi_upload
|
||||
(relId, thirdSysFk, uploadStatus, uploadMsg, uploadCode, remark, updateTime, submitTime)
|
||||
values (
|
||||
#{relId},
|
||||
#{thirdSysFk},
|
||||
#{uploadStatus},
|
||||
#{uploadMsg},
|
||||
#{uploadCode},
|
||||
#{remark},
|
||||
#{updateTime},
|
||||
#{submitTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
<delete id="deleteById" parameterType="Map">
|
||||
DELETE
|
||||
FROM basic_new_udi_upload
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<update id="updateNewUploadDi" parameterType="com.glxp.api.admin.entity.basic.NewUploadDiEntity">
|
||||
UPDATE basic_new_udi_upload
|
||||
<set>
|
||||
<if test="relId != null">relId=#{relId},</if>
|
||||
<if test="thirdSysFk != null">thirdSysFk=#{thirdSysFk},</if>
|
||||
<if test="updateTime != null">updateTime=#{updateTime},</if>
|
||||
<if test="uploadStatus != null">uploadStatus=#{uploadStatus},</if>
|
||||
<if test="uploadMsg != null">uploadMsg=#{uploadMsg},</if>
|
||||
<if test="uploadCode != null">uploadCode=#{uploadCode},</if>
|
||||
<if test="remark != null">remark=#{remark},</if>
|
||||
<if test="updateTime != null">updateTime=#{updateTime},</if>
|
||||
<if test="submitTime != null">submitTime=#{submitTime},</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue