feat: 迁移国内标准法规部分2 创建国内标准法规

This commit is contained in:
super_liu
2021-06-03 13:39:40 +08:00
parent 4cc558befc
commit 4caa481d31
36 changed files with 2181 additions and 31 deletions
@@ -0,0 +1,23 @@
package com.adc.da.slrs.sarStandFile.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.adc.da.slrs.sarStandFile.entity.SarStandFile;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.adc.da.base.web.BaseController;
/**
* <p>
* 前端控制器
* </p>
*
* @author super_liu
* @since 2021-06-02
*/
@RestController
@Api(description = "|SarStandFile|")
@RequestMapping("/sarStandFile/sar-stand-file")
public class SarStandFileController extends BaseController<SarStandFile> {
}
@@ -0,0 +1,32 @@
package com.adc.da.slrs.sarStandFile.dao;
import com.adc.da.slrs.sarStandFile.entity.SarStandFile;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author super_liu
* @since 2021-06-02
*/
public interface SarStandFileDao extends BaseMapper<SarStandFile> {
List<SarStandFile> selectFileByStandId(String lawsId);
List<SarStandFile> selectFileByAttId(String attId);
List<SarStandFile> selectFileByResId(SarStandFile sarStandFileEO);
List<SarStandFile> selectFileByStandIdAndId(SarStandFile sarStandFileEO);
List<SarStandFile> selectFileMsgByAttId(String attId);
int deleteByStandId(String standId);
int insertForeach(List<SarStandFile> list); //批量新增
}
@@ -0,0 +1,106 @@
package com.adc.da.slrs.sarStandFile.entity;
import com.adc.da.base.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Transient;
import org.springframework.format.annotation.DateTimeFormat;
/**
* <p>
*
* </p>
*
* @author super_liu
* @since 2021-06-02
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="SarStandFile对象", description="")
public class SarStandFile extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId("ID")
private String id;
@ApiModelProperty(value = "标准ID")
@TableField("STAND_ID")
private String standId;
@ApiModelProperty(value = "标准文件分类")
@TableField("STAND_FILE_CLASSIFY")
private String standFileClassify;
@ApiModelProperty(value = "文件主键")
@TableField("ATT_ID")
private String attId;
@ApiModelProperty(value = "文件名称")
@TableField("FILE_NAME")
private String fileName;
@ApiModelProperty(value = "文件后缀")
@TableField("FILE_SUFFIX")
private String fileSuffix;
@ApiModelProperty(value = "使用模式(SOURCE_FILE原文件,WEB_FILE转换后文件)")
@TableField("USE_MODEL")
private String useModel;
@ApiModelProperty(value = "加密密码")
@TableField("PASSWORD")
private String password;
@TableField("CREATION_USER")
private String creationUser;
@ApiModelProperty(value = "是否有效")
@TableField("VALID_FLAG")
private String validFlag;
@ApiModelProperty(value = "创建时间")
@TableField("CREATION_TIME")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date creationTime;
@ApiModelProperty(value = "修改时间")
@TableField("MODIFY_TIME")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date modifyTime;
@ApiModelProperty(value = "转换原文件id")
@TableField("ORI_ATT_ID")
private String oriAttId;
@Transient
private String resId;
@Transient
private Integer pageCount;
@Transient
private String fileOldName;
@Transient
private List<String> idlist = new ArrayList<>();
@Transient
private String standFileClassifyShow;
@Transient
private String standNumber;
@Transient
private String standName;
@Transient
private String sarType;
}
@@ -0,0 +1,16 @@
package com.adc.da.slrs.sarStandFile.service;
import com.adc.da.slrs.sarStandFile.entity.SarStandFile;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author super_liu
* @since 2021-06-02
*/
public interface ISarStandFileService extends IService<SarStandFile> {
}
@@ -0,0 +1,20 @@
package com.adc.da.slrs.sarStandFile.service.impl;
import com.adc.da.slrs.sarStandFile.entity.SarStandFile;
import com.adc.da.slrs.sarStandFile.dao.SarStandFileDao;
import com.adc.da.slrs.sarStandFile.service.ISarStandFileService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author super_liu
* @since 2021-06-02
*/
@Service
public class SarStandFileServiceImpl extends ServiceImpl<SarStandFileDao, SarStandFile> implements ISarStandFileService {
}
@@ -0,0 +1,23 @@
package com.adc.da.slrs.sarStandMenu.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.adc.da.slrs.sarStandMenu.entity.SarStandMenu;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.adc.da.base.web.BaseController;
/**
* <p>
* 前端控制器
* </p>
*
* @author super_liu
* @since 2021-06-01
*/
@RestController
@Api(description = "|SarStandMenu|")
@RequestMapping("/SarStandMenu/sar-stand-menu")
public class SarStandMenuController extends BaseController<SarStandMenu> {
}
@@ -0,0 +1,27 @@
package com.adc.da.slrs.sarStandMenu.dao;
import com.adc.da.slrs.sarStandMenu.entity.SarStandMenu;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import javax.annotation.Resource;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author super_liu
* @since 2021-06-01
*/
@Resource
public interface SarStandMenuDao extends BaseMapper<SarStandMenu> {
int deleteByStandId(String standId);
List<SarStandMenu> selectMenuByMenuParentId(SarStandMenu sarStandMenuEO);
int updateByStandIdAndMenuId(SarStandMenu sarStandMenuEO);
int deleteByStandIdAndMenuId(SarStandMenu sarStandMenuEO);
}
@@ -0,0 +1,58 @@
package com.adc.da.slrs.sarStandMenu.entity;
import com.adc.da.base.entity.BaseEntity;
import java.math.BigDecimal;
import java.util.List;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Transient;
/**
* <p>
*
* </p>
*
* @author super_liu
* @since 2021-06-01
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="SarStandMenu对象", description="")
public class SarStandMenu extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId("ID")
private String id;
@ApiModelProperty(value = "标准ID")
@TableField("STAND_ID")
private String standId;
@ApiModelProperty(value = "目录ID")
@TableField("MENU_ID")
private String menuId;
@ApiModelProperty(value = "是否有效")
@TableField("VALID_FLAG")
private Integer validFlag;
@Transient
private String oldMenuId;
@Transient
private String standType;
@Transient
private String[] idlist;
@Transient
private List<String> menuIds;
}
@@ -0,0 +1,16 @@
package com.adc.da.slrs.sarStandMenu.service;
import com.adc.da.slrs.sarStandMenu.entity.SarStandMenu;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author super_liu
* @since 2021-06-01
*/
public interface ISarStandMenuService extends IService<SarStandMenu> {
}
@@ -0,0 +1,20 @@
package com.adc.da.slrs.sarStandMenu.service.impl;
import com.adc.da.slrs.sarStandMenu.entity.SarStandMenu;
import com.adc.da.slrs.sarStandMenu.dao.SarStandMenuDao;
import com.adc.da.slrs.sarStandMenu.service.ISarStandMenuService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author super_liu
* @since 2021-06-01
*/
@Service
public class SarStandMenuServiceImpl extends ServiceImpl<SarStandMenuDao, SarStandMenu> implements ISarStandMenuService {
}
@@ -0,0 +1,23 @@
package com.adc.da.slrs.sarStandPutTime.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.adc.da.slrs.sarStandPutTime.entity.SarStandPutTime;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.adc.da.base.web.BaseController;
/**
* <p>
* 前端控制器
* </p>
*
* @author super_liu
* @since 2021-06-02
*/
@RestController
@Api(description = "|SarStandPutTime|")
@RequestMapping("/sarStandPutTime/sar-stand-put-time")
public class SarStandPutTimeController extends BaseController<SarStandPutTime> {
}
@@ -0,0 +1,21 @@
package com.adc.da.slrs.sarStandPutTime.dao;
import com.adc.da.slrs.sarStandPutTime.entity.SarStandPutTime;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author super_liu
* @since 2021-06-02
*/
public interface SarStandPutTimeDao extends BaseMapper<SarStandPutTime> {
int deleteByStandId(String standId);
int insertForeach(List<SarStandPutTime> list); //批量新增
}
@@ -0,0 +1,61 @@
package com.adc.da.slrs.sarStandPutTime.entity;
import com.adc.da.base.entity.BaseEntity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author super_liu
* @since 2021-06-02
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="SarStandPutTime对象", description="")
public class SarStandPutTime extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId("ID")
private String id;
@ApiModelProperty(value = "标准基础表主键")
@TableField("STAND_ID")
private String standId;
@ApiModelProperty(value = "日期名称")
@TableField("TIME_NAME")
private String timeName;
@ApiModelProperty(value = "实施日期")
@TableField("PUT_TIME")
private Date putTime;
@ApiModelProperty(value = "日期类型")
@TableField("TIME_TYPE")
private String timeType;
@ApiModelProperty(value = "展示顺序")
@TableField("ORDER_NUM")
private String orderNum;
@ApiModelProperty(value = "创建时间")
@TableField("CREATION_TIME")
private Date creationTime;
}
@@ -0,0 +1,16 @@
package com.adc.da.slrs.sarStandPutTime.service;
import com.adc.da.slrs.sarStandPutTime.entity.SarStandPutTime;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author super_liu
* @since 2021-06-02
*/
public interface ISarStandPutTimeService extends IService<SarStandPutTime> {
}
@@ -0,0 +1,20 @@
package com.adc.da.slrs.sarStandPutTime.service.impl;
import com.adc.da.slrs.sarStandPutTime.entity.SarStandPutTime;
import com.adc.da.slrs.sarStandPutTime.dao.SarStandPutTimeDao;
import com.adc.da.slrs.sarStandPutTime.service.ISarStandPutTimeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author super_liu
* @since 2021-06-02
*/
@Service
public class SarStandPutTimeServiceImpl extends ServiceImpl<SarStandPutTimeDao, SarStandPutTime> implements ISarStandPutTimeService {
}
@@ -0,0 +1,23 @@
package com.adc.da.slrs.sarStandVal.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.adc.da.slrs.sarStandVal.entity.SarStandVal;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.adc.da.base.web.BaseController;
/**
* <p>
* 前端控制器
* </p>
*
* @author super_liu
* @since 2021-06-01
*/
@RestController
@Api(description = "|SarStandVal|")
@RequestMapping("/sarStandVal/sar-stand-val")
public class SarStandValController extends BaseController<SarStandVal> {
}
@@ -0,0 +1,23 @@
package com.adc.da.slrs.sarStandVal.dao;
import com.adc.da.slrs.sarStandVal.entity.SarStandVal;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author super_liu
* @since 2021-06-01
*/
public interface SarStandValDao extends BaseMapper<SarStandVal> {
//通过标准id删除表中数据
int deleteDataByStandid(String standId);
int insertForeach(List<SarStandVal> list); //批量新增
}
@@ -0,0 +1,65 @@
package com.adc.da.slrs.sarStandVal.entity;
import com.adc.da.base.entity.BaseEntity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author super_liu
* @since 2021-06-01
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="SarStandVal对象", description="")
public class SarStandVal extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId("ID")
private String id;
@ApiModelProperty(value = "标准ID")
@TableField("STAND_ID")
private String standId;
@ApiModelProperty(value = "参数类型")
@TableField("PROPERTY_TYPE")
private String propertyType;
@ApiModelProperty(value = "参数内容")
@TableField("PROPERTY_VAL")
private String propertyVal;
@ApiModelProperty(value = "展示顺序")
@TableField("ORDER_NUM")
private Integer orderNum;
@ApiModelProperty(value = "是否有效")
@TableField("VALID_FLAG")
private Integer validFlag;
@ApiModelProperty(value = "创建时间")
@TableField("CREATION_TIME")
private Date creationTime;
@ApiModelProperty(value = "修改时间")
@TableField("MODIFY_TIME")
private Date modifyTime;
}
@@ -0,0 +1,16 @@
package com.adc.da.slrs.sarStandVal.service;
import com.adc.da.slrs.sarStandVal.entity.SarStandVal;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author super_liu
* @since 2021-06-01
*/
public interface ISarStandValService extends IService<SarStandVal> {
}
@@ -0,0 +1,20 @@
package com.adc.da.slrs.sarStandVal.service.impl;
import com.adc.da.slrs.sarStandVal.entity.SarStandVal;
import com.adc.da.slrs.sarStandVal.dao.SarStandValDao;
import com.adc.da.slrs.sarStandVal.service.ISarStandValService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author super_liu
* @since 2021-06-01
*/
@Service
public class SarStandValServiceImpl extends ServiceImpl<SarStandValDao, SarStandVal> implements ISarStandValService {
}
@@ -140,4 +140,18 @@ public class SarStandardsInfoController extends BaseController<SarStandardsInfo>
return Result.success(getPageInfo(page.getPager(), rows));
}
@ApiOperation(value = "|SarStandardsInfoEO|新增")
@PostMapping("/addarStandardsInfo")
//401问题2021-03-31暂时注释掉 liuhuiwen
// @RequiresPermissions("lawss:sarStandardsInfo:create")
public ResponseMessage<SarStandardsInfo> create(@RequestBody SarStandardsInfo sarStandardsInfoEO) throws Exception {
if (StringUtils.isBlank(sarStandardsInfoEO.getMenuId()) && "INLAND".equals(sarStandardsInfoEO.getStandType())) {
sarStandardsInfoEO.setMenuId("64df1d5522bb49c09af2");
} else if (StringUtils.isBlank(sarStandardsInfoEO.getMenuId()) && "FOREIGN".equals(sarStandardsInfoEO.getStandType())) {
sarStandardsInfoEO.setMenuId("22179d54d4e640098e29");
}
sarStandardsInfoEOService.createSarStandardsInfo(sarStandardsInfoEO);
return Result.success("0", "添加成功", sarStandardsInfoEO);
}
}
@@ -22,6 +22,8 @@ public interface SarStandardsInfoDao extends BaseMapper<SarStandardsInfo> {
int getSarStandardsInfoCount(SarStandardsInfoEOPage page);
int insertSelective(SarStandardsInfo page);
SarStandardsInfo selectByPrimaryKeyAndModifyTime(SarStandardsInfo page);
List<SarStandardsInfo> selectStandardsByStandnumber(SarStandardsInfo sarStandardsInfoEO);
@@ -124,56 +124,56 @@ public class SarStandardsInfo extends BaseEntity {
// 以下为非表中字段
@Transient
@TableField(exist = false)
private String collectId; // 收藏表ID
@Transient
@TableField(exist = false)
private String countryShow; //国家地区显示名称
@Transient
@TableField(exist = false)
private String standSortShow; // 标准类别显示名称
@Transient
@TableField(exist = false)
private String standStateShow; // 标准状态显示名称
@Transient
@TableField(exist = false)
private String standNatureShow; // 标准性质显示名称
@Transient
@TableField(exist = false)
private String sychronId; // 同步数据ID
@Transient
@TableField(exist = false)
private List<DicTypeEO> dicTypeList = new ArrayList(); // 记录标准涉及到的所有数据字典数据
@Transient
@TableField(exist = false)
private Map<String, Object> attrInfoMap = new LinkedHashMap<>(); //属性表字段与值
@Transient
@TableField(exist = false)
private String sarStandAttrEOStr; //新增修改时属性表信息
@Transient
@TableField(exist = false)
private String menuId; //目录ID
@Transient
@TableField(exist = false)
private int upReplaceNumFlag; //记录是否修改了替代文件号
@Transient
@TableField(exist = false)
private int upNumFlag; //记录是否修改了文件号
@Transient
@TableField(exist = false)
private String fileIds; //全部文件ID
@Transient
@TableField(exist = false)
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
private Date newCarPutTime;
@Transient
@TableField(exist = false)
private List<SarStandItems> itemsList = new ArrayList<>();
@Transient
@TableField(exist = false)
private String relateStand;//对应其他标准
@Transient
@TableField(exist = false)
private String accessCountry;//纳入清单的国家
@Transient
@TableField(exist = false)
private String processNum;//流程编号
@Transient
@TableField(exist = false)
private String textStatus;//文本状态
// 在库里的标准节点类型(工作组)
@Transient
@TableField(exist = false)
private String menuType;
@Transient
@TableField(exist = false)
private String allPutTime;
@Transient
@TableField(exist = false)
private String jspg;
@Transient
@TableField(exist = false)
private String CHJL;
@Transient
@TableField(exist = false)
private String putTime2;
}
@@ -22,7 +22,7 @@ public interface ISarStandardsInfoService extends IService<SarStandardsInfo> {
List<SarStandardsInfo> getSarStandardsInfoPage(SarStandardsInfoEOPage page) throws Exception;
// void createSarStandardsInfo(SarStandardsInfo sarStandardsInfoEO) throws Exception;
void createSarStandardsInfo(SarStandardsInfo sarStandardsInfoEO) throws Exception;
//
// int updateSarStandardsInfo(SarStandardsInfo sarStandardsInfoEO) throws Exception;
//
@@ -3,26 +3,44 @@ package com.adc.da.slrs.sarStandardsInfo.service.impl;
import com.adc.da.att.entity.AttFileEO;
import com.adc.da.att.service.IAttFileEOService;
import com.adc.da.common.*;
import com.adc.da.person.entity.PersonMsgEO;
import com.adc.da.person.service.IPersonCollectEOService;
import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao;
import com.adc.da.slrs.sarStandFile.dao.SarStandFileDao;
import com.adc.da.slrs.sarStandFile.entity.SarStandFile;
import com.adc.da.slrs.sarStandItems.dao.SarStandItemsDao;
import com.adc.da.slrs.sarStandItems.entity.SarStandItems;
import com.adc.da.slrs.sarStandMenu.dao.SarStandMenuDao;
import com.adc.da.slrs.sarStandMenu.entity.SarStandMenu;
import com.adc.da.slrs.sarStandPutTime.dao.SarStandPutTimeDao;
import com.adc.da.slrs.sarStandPutTime.entity.SarStandPutTime;
import com.adc.da.slrs.sarStandVal.dao.SarStandValDao;
import com.adc.da.slrs.sarStandVal.entity.SarStandVal;
import com.adc.da.slrs.sarStandardsInfo.entity.*;
import com.adc.da.slrs.sarMenu.service.ISarMenuService;
import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao;
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
import com.adc.da.slrs.sarUpdLog.service.ISarUpdLogService;
import com.adc.da.slrs.sysInfo.service.SysInfoEOService;
import com.adc.da.sys.common.SelectionResult;
import com.adc.da.sys.constant.ValueStateEnum;
import com.adc.da.sys.dao.DicTypeEODao;
import com.adc.da.util.LoginUserUtil;
import com.adc.da.util.UUIDUtils;
import com.adc.da.utils.util.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.sql.Clob;
import java.text.SimpleDateFormat;
import java.util.*;
/**
@@ -34,6 +52,7 @@ import java.util.*;
* @since 2021-05-31
*/
@Service
@Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao, SarStandardsInfo> implements ISarStandardsInfoService {
private static final Logger logger = LoggerFactory.getLogger(SarStandardsInfoServiceImpl.class);
@@ -50,9 +69,24 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
@Autowired
private IPersonCollectEOService personCollectEOService;
@Autowired
private ISarUpdLogService sarUpdLogEOService;
@Autowired
private SarStandFileDao sarStandFileEODao;
@Autowired
private SarStandValDao sarStandValEODao;
@Autowired
private SarStandPutTimeDao sarStandPutTimeEODao;
@Autowired
private SarStandAttrInfoDao sarStandAttrInfoEODao;
@Autowired
private SarStandMenuDao sarStandMenuEODao;
@Autowired
private IAttFileEOService attFileEOService;
@@ -231,4 +265,553 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
}
}
}
/***
* @Description: 新增标准
* @Author: yangxuenan
* @Date: 2020/9/8 9:15
* @Param: [sarStandardsInfoEO]
* @Return: void
*/
public void createSarStandardsInfo(SarStandardsInfo sarStandardsInfoEO) throws Exception {
// 处理基础表信息
sarStandardsInfoEO.setId(UUIDUtils.randomUUID20());
sarStandardsInfoEO.setCreationUser(LoginUserUtil.getUserId());
sarStandardsInfoEO.setValidFlag("0");
sarStandardsInfoEO.setCreationTime(new Date());
sarStandardsInfoEO.setModifyTime(new Date());
//根据新建标准所在目录,确定此处是否需要在标准目录关联表中插入数据
if (StringUtils.isNotEmpty(sarStandardsInfoEO.getMenuId())) {
SarStandMenu sarStandMenuEO = new SarStandMenu();
sarStandMenuEO.setStandId(sarStandardsInfoEO.getId());
sarStandMenuEO.setMenuId(sarStandardsInfoEO.getMenuId());
sarStandMenuEO.setValidFlag(ValueStateEnum.VALUE_TRUE.getValue());
sarStandMenuEO.setId(UUIDUtils.randomUUID20());
sarStandMenuEODao.insert(sarStandMenuEO);
}
// 根据其他字段,生成标准状态
updateStandState(sarStandardsInfoEO,null);
int insertResult = dao.insertSelective(sarStandardsInfoEO);
if (insertResult > 0) {
// 修改属性表数据
sarStandAttrInfoEODao.deleteStandAttrByStandId(sarStandardsInfoEO.getId());
//编写预警信息
// writeWarnings(sarStandardsInfoEO);
updateCiteStand(sarStandardsInfoEO,null,"DTBJH","BDTBZBH");
updateCiteStand(sarStandardsInfoEO,null,"YYBJ","BYYBJ");
updateRelateStand(sarStandardsInfoEO,"CBBH");
// 根据代替标准号修改被代替的标准的状态 修改为已修订状态
replaseStandState(sarStandardsInfoEO);
// 处理属性表信息
if (StringUtils.isNotBlank(sarStandardsInfoEO.getSarStandAttrEOStr())) {
createStandAttrInfo(sarStandardsInfoEO);
}
// 增加关联事件
String number = sarStandardsInfoEO.getStandSort() + " " + sarStandardsInfoEO.getStandNumber();
if (StringUtils.isNotBlank(sarStandardsInfoEO.getStandYear())) {
number += "-" + sarStandardsInfoEO.getStandYear();
}
String content = "新增" + number + "" + sarStandardsInfoEO.getStandName() + "";
sarUpdLogEOService.createBaseLog(sarStandardsInfoEO.getId(),sarStandardsInfoEO.getStandType()+"_STAND",content);
// if(elasflag) {
// // 消息队列
// createStandMQService.sendStandMQ(sarStandardsInfoEO,"add");
// }
}
}
/***
* @Description: 新增属性表数据
* @Author: yangxuenan
* @Date: 2020/9/8 9:53
* @Param: [sarStandardsInfoEO]
* @Return: void
*/
public void createStandAttrInfo (SarStandardsInfo sarStandardsInfoEO) throws Exception {
String sarStandAttrEOStr = sarStandardsInfoEO.getSarStandAttrEOStr();
String mustFields = FieldConvertUtil.mustFields;
String mustValues = FieldConvertUtil.mustValues(sarStandardsInfoEO.getId());
// 将字符串转为map进行解析
Map<String,String> sarStandAttrMap = JSONObject.fromObject(sarStandAttrEOStr);
StringBuilder fieldsBuilder = new StringBuilder();
StringBuilder valuesBuilder = new StringBuilder();
Map<String,String> selectionMap = new HashMap<>();
Map<String,String> fileMap = new HashMap<>();
Map<String,String> multiTimeMap = new HashMap<>();
String fileIds = "";
for (Map.Entry<String,String> entry : sarStandAttrMap.entrySet()) {
String attrKey = entry.getKey();
String attrValue = String.valueOf(entry.getValue());
if (InitStandAttrUtil.queryFieldList != null && !InitStandAttrUtil.queryFieldList.isEmpty()) {
if (InitStandAttrUtil.queryFieldList.contains(attrKey)) {
fieldsBuilder.append("," + attrKey);
if ("YYBJ".equals(attrKey)) {
sarStandardsInfoEO.setCiteStand(attrValue);
} else if ("CBBH".equals(attrKey)) {
sarStandardsInfoEO.setRelateStand(attrValue);
} else if ("DTBJH".equals(attrKey)) {
sarStandardsInfoEO.setReplaceStandNum(attrValue);
}
// 多选项,文件类型需要单独处理 向子表添加数据
if (InitStandAttrUtil.selectionFieldList.contains(attrKey)) {
selectionMap.put(attrKey,attrValue);
} else if (InitStandAttrUtil.fileFieldList.contains(attrKey)) {
fileMap.put(attrKey,attrValue);
fileIds += attrValue + ",";
if(attrKey.equals("XXZLXX")){
// this.saveMsgDynamicInfo(attrValue,sarStandardsInfoEO.getStandName(),sarStandardsInfoEO.getId(),sarStandardsInfoEO.getStandSort()+" "+sarStandardsInfoEO.getStandNumber()+"-"+sarStandardsInfoEO.getStandYear());
}
} else if (InitStandAttrUtil.multiTimeFieldList.contains(attrKey)) {
multiTimeMap.put(attrKey,attrValue);
}
// 不同类型存储数据需单独处理值
if (InitStandAttrUtil.numFieldList.contains(attrKey)) {
if (StringUtils.isBlank(attrValue)) {
attrValue = "null";
}
} else if (InitStandAttrUtil.timeFieldList.contains(attrKey)) {
attrValue = FieldConvertUtil.changeTimeValue(attrValue);
} else {
attrValue = "'" + attrValue + "'";
}
valuesBuilder.append("," + attrValue);
sarStandardsInfoEO.setFileIds(fileIds);
}
}
}
String insertField = mustFields + fieldsBuilder.toString();
String insertValue = mustValues + valuesBuilder.toString();
int insertRes = sarStandAttrInfoEODao.insertStandAttr(insertField,insertValue);
if (insertRes > 0) {
// 多选项处理
createStandVal(sarStandardsInfoEO.getId(),selectionMap);
// 文件处理
createStandFile(sarStandardsInfoEO.getId(),fileMap);
// 多时间处理
createStandPutTime(sarStandardsInfoEO.getId(),multiTimeMap);
}
}
/***
* @Description: 多选项处理
* @Author: yangxuenan
* @Date: 2020/9/8 14:37
* @Param: [sarStandardsInfoEO, selectionMap]
* @Return: void
*/
public void createStandVal (String standId,Map<String,String> selectionMap) {
if (selectionMap != null && selectionMap.size() > 0) {
List<SarStandVal> standValList = new ArrayList<>();
for (Map.Entry<String,String> entry : selectionMap.entrySet()) {
String value = entry.getValue();
String field = entry.getKey();
if (StringUtils.isNotBlank(value)) {
String[] valArr = value.trim().split(",");
for (String val : valArr) {
SarStandVal sarStandValEO = new SarStandVal();
sarStandValEO.setValidFlag(ValueStateEnum.VALUE_TRUE.getValue());
sarStandValEO.setCreationTime(new Date());
sarStandValEO.setModifyTime(new Date());
sarStandValEO.setStandId(standId);
sarStandValEO.setId(UUIDUtils.randomUUID20());
sarStandValEO.setPropertyType(field);
sarStandValEO.setPropertyVal(val);
standValList.add(sarStandValEO);
}
}
}
if (standValList != null && !standValList.isEmpty()) {
sarStandValEODao.insertForeach(standValList);
}
}
}
/***
* @Description: 文件处理
* @Author: yangxuenan
* @Date: 2020/9/8 15:01
* @Param: [standId, fileMap]
* @Return: void
*/
public void createStandFile (String standId,Map<String,String> fileMap) throws Exception {
if (fileMap != null && fileMap.size() > 0) {
List<SarStandFile> standFileList = new ArrayList<>();
for (Map.Entry<String,String> entry : fileMap.entrySet()) {
String value = entry.getValue();
String field = entry.getKey();
if (StringUtils.isNotBlank(value)) {
List<AttFileEO> fileList = attFileEOService.getMultiFileInfos(value);
if (fileList != null && !fileList.isEmpty()) {
createStandFileAppend(standId,field,fileList,standFileList);
}
}
}
if (standFileList != null && !standFileList.isEmpty()) {
sarStandFileEODao.insertForeach(standFileList);
}
}
}
public void createStandFileAppend (String standId,String field,List<AttFileEO> fileList,List<SarStandFile> standFileList) throws Exception {
for (AttFileEO fileInfo : fileList) {
SarStandFile sarStandFileEO = new SarStandFile();
sarStandFileEO.setCreationUser(LoginUserUtil.getUserId());
sarStandFileEO.setCreationTime(new Date());
sarStandFileEO.setModifyTime(new Date());
sarStandFileEO.setValidFlag("0");
sarStandFileEO.setStandId(standId); //标准ID
sarStandFileEO.setUseModel(UseModuleEnum.SOURCE_FILE.getValue()); //文件使用模式
sarStandFileEO.setId(UUIDUtils.randomUUID20());
sarStandFileEO.setAttId(fileInfo.getId()); //文件ID
sarStandFileEO.setStandFileClassify(field); //文件分类
sarStandFileEO.setFileName(fileInfo.getOldFileName());
sarStandFileEO.setFileSuffix(fileInfo.getFileSuffix());
sarStandFileEO.setOriAttId(fileInfo.getId());
standFileList.add(sarStandFileEO);
//文档转换
if ("pdf".equals(fileInfo.getFileSuffix()) || "PDF".equals(fileInfo.getFileSuffix())) {
SarStandFile newFileEO = new SarStandFile();
newFileEO.setCreationUser(LoginUserUtil.getUserId());
newFileEO.setCreationTime(new Date());
newFileEO.setModifyTime(new Date());
newFileEO.setValidFlag("0");
newFileEO.setStandId(standId); //标准ID
newFileEO.setId(UUIDUtils.randomUUID20());
newFileEO.setAttId(fileInfo.getId()); //文件ID
newFileEO.setStandFileClassify(field); //文件分类
newFileEO.setFileName(fileInfo.getOldFileName());
newFileEO.setFileSuffix(fileInfo.getFileSuffix());
newFileEO.setUseModel(UseModuleEnum.WEB_FILE.getValue()); //文件使用模式 //文件名称@@@@@@@需要修改
newFileEO.setOriAttId(fileInfo.getId());
standFileList.add(newFileEO);
} else {
// String filePath = fileInfo.getFilePath() + fileInfo.getFileName();
// ConvertMqEO convert = new ConvertMqEO();
// convert.setLawsId(standId);
// convert.setAttId(fileInfo.getId());
// convert.setFilePath(filePath);
// convert.setAddOrUp("0");
// convert.setFileSuffix(fileInfo.getFileSuffix());
// convert.setStandFileClassify(field);
// convert.setConvertType(SarTypeEnum.STAND.getValue());
// convert.setOriAttId(fileInfo.getId());
// convertMq.sendMQ(convert);
}
}
}
public void createStandPutTime(String standId,Map<String,String> multiTimeMap) throws Exception{
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
if (multiTimeMap != null && multiTimeMap.size() > 0) {
List<SarStandPutTime> standTimeList = new ArrayList<>();
for (Map.Entry<String, String> entry : multiTimeMap.entrySet()) {
String value = entry.getValue();
String field = entry.getKey();
if (StringUtils.isNotBlank(value)) {
String[] valArr = value.trim().split(",");
int i=0;
for (String val : valArr) {
if ("N/A".equals(val) && "TBD".equals(val) && "已实施".equals(val)) {
i++;
Date date = sdf.parse(val);
SarStandPutTime sarStandPutTimeEO = new SarStandPutTime();
sarStandPutTimeEO.setId(UUIDUtils.randomUUID20());
sarStandPutTimeEO.setStandId(standId);
sarStandPutTimeEO.setTimeType(field);
sarStandPutTimeEO.setCreationTime(new Date());
// sarStandPutTimeEO.setOrderNum(Integer.valueOf(i));
sarStandPutTimeEO.setTimeName(field);
sarStandPutTimeEO.setPutTime(date);
standTimeList.add(sarStandPutTimeEO);
}
}
}
}
// 批量新增
if (standTimeList != null && !standTimeList.isEmpty()) {
sarStandPutTimeEODao.insertForeach(standTimeList);
}
}
}
// 新增修改标准过程中,根据代替标准号,修改被代替标准号对应的标准
public void updateCiteStand(SarStandardsInfo sarStandardsInfoEO,SarStandardsInfo beforeSarStandardsInfo,String upField,String beUpedField) throws Exception {
// 记录要被代替标准号的数据
// SarStandardsInfoEO chageEO= new SarStandardsInfoEO();
SarStandardsInfo sarStandardsSelectEO = new SarStandardsInfo();
String addStrandNumber = "";
String beforeStrandNumber = "";
if(StringUtils.isNotEmpty(sarStandardsInfoEO.getStandYear())){
addStrandNumber = sarStandardsInfoEO.getStandSort()+" " +sarStandardsInfoEO.getStandNumber()+"-"+sarStandardsInfoEO.getStandYear();
} else {
addStrandNumber = sarStandardsInfoEO.getStandSort()+" " +sarStandardsInfoEO.getStandNumber();
}
if(beforeSarStandardsInfo!= null ) {
if (StringUtils.isNotEmpty(beforeSarStandardsInfo.getStandYear())) {
beforeStrandNumber = beforeSarStandardsInfo.getStandSort() + " " + beforeSarStandardsInfo.getStandNumber() + "-" + beforeSarStandardsInfo.getStandYear();
} else {
beforeStrandNumber = beforeSarStandardsInfo.getStandSort() + " " + beforeSarStandardsInfo.getStandNumber();
}
}
// 以“,”分隔查看之前是否有 ,如果有不修改,如果没有,追加修改
String newCiteStand = "";
if ("YYBJ".equals(upField)) {
newCiteStand = sarStandardsInfoEO.getCiteStand();
} else if ("CBBH".equals(upField)) {
newCiteStand = sarStandardsInfoEO.getRelateStand();
} else if ("DTBJH".equals(upField)) {
newCiteStand = sarStandardsInfoEO.getReplaceStandNum();
}
if(StringUtils.isNotEmpty(newCiteStand) && newCiteStand.split(",").length>0){
// 主要逻辑处理新增的
String nowEOrepNums[] = newCiteStand.split(",");
for (String citeStand: nowEOrepNums){
sarStandardsSelectEO.setStandNumber(citeStand);
if (StringUtils.isNotBlank(sarStandardsSelectEO.getStandNumber())){
String sort = "";
if (sarStandardsSelectEO.getStandNumber().length()>3) {
sort = sarStandardsSelectEO.getStandNumber().substring(0, 3);
}
if ("ECE".equals(sort)) {
int length = sarStandardsSelectEO.getStandNumber().length();
String number = sarStandardsSelectEO.getStandNumber().substring(3,length);
sarStandardsSelectEO.setStandNumber("UN(ECE)" + number);
}
}
List<SarStandardsInfo> result = dao.selectStandardsByStandnumber(sarStandardsSelectEO);
if (result != null && result.size()>0){
String standId = result.get(0).getId();
String field = beUpedField;
String citedStand = sarStandAttrInfoEODao.selectFieldValByStandId(field,result.get(0).getId());
String changeCitedStand = "";
if(StringUtils.isNotBlank(citedStand)){
String[] beforeReplacedStandNumStr = citedStand.split(",");
if (Arrays.asList(beforeReplacedStandNumStr).contains(addStrandNumber)){
continue;
} else {
changeCitedStand = citedStand+","+ addStrandNumber;
}
} else {
changeCitedStand = addStrandNumber;
}
sarStandAttrInfoEODao.updateStandInfo(standId,field,changeCitedStand);
}
}
// 如果id不为空,说明是修改,有逻辑删除的执行以下语句,存在之前是三项,现在修改成两项的情况
if (null != beforeSarStandardsInfo){
String oldCiteStand = String.valueOf(beforeSarStandardsInfo.getAttrInfoMap().get(upField));
if(StringUtils.isNotEmpty(oldCiteStand)) {
String [] beforeEOrepNums = oldCiteStand.split(",");
for (String beforeStr:beforeEOrepNums){
// 如果再旧的中包含,在新的中没有,需要删除
if (!Arrays.asList(nowEOrepNums).contains(beforeStr)){
sarStandardsSelectEO.setStandNumber(beforeStr);
List<SarStandardsInfo> result = dao.selectStandardsByStandnumber(sarStandardsSelectEO);
if (result != null && result.size()>0){
String standId = result.get(0).getId();
String field = beUpedField;
String citedStand = sarStandAttrInfoEODao.selectFieldValByStandId(field,result.get(0).getId());
String changeCitedStand = "";
if(StringUtils.isNotBlank(citedStand)){
String[] beforerepalced = citedStand.split(",");
ArrayList beforlist = new ArrayList<>(Arrays.asList(beforerepalced));
if (beforlist.contains(beforeStrandNumber)){
beforlist.remove(beforeStrandNumber);
changeCitedStand = StringUtils.join(beforlist.toArray(), ",");
} else {
continue;
}
sarStandAttrInfoEODao.updateStandInfo(standId,field,changeCitedStand);
}
}
}
}
}
}
} else {
// 如果为空,判断是否为修改
if (null != beforeSarStandardsInfo){
String oldCiteStand = String.valueOf(beforeSarStandardsInfo.getAttrInfoMap().get("YYBJ"));
if(StringUtils.isNotEmpty(oldCiteStand)) {
String [] beforeEOrepNums = oldCiteStand.split(",");
for (String beforeStr:beforeEOrepNums){
// 如果再旧的中包含,在新的中没有,需要删除,相关数据取第一条是因为标准号是唯一的
sarStandardsSelectEO.setStandNumber(beforeStr);
List<SarStandardsInfo> result = dao.selectStandardsByStandnumber(sarStandardsSelectEO);
if (result != null && result.size()>0){
String standId = result.get(0).getId();
String field = "BYYBJ";
String citedStand = sarStandAttrInfoEODao.selectFieldValByStandId(field,result.get(0).getId());
String changeCitedStand = "";
if(StringUtils.isNotBlank(citedStand)){
String[] beforerepalced = citedStand.split(",");
ArrayList beforlist = new ArrayList<>(Arrays.asList(beforerepalced));
if (beforlist.contains(beforeStrandNumber)){
beforlist.remove(beforeStrandNumber);
changeCitedStand = StringUtils.join(beforlist.toArray(), ",");
} else {
continue;
}
sarStandAttrInfoEODao.updateStandInfo(standId,field,changeCitedStand);
}
}
}
}
}
}
}
public void updateRelateStand(SarStandardsInfo sarStandardsInfoEO,String upField){
String addStandNumber = "";
if(StringUtils.isNotEmpty(sarStandardsInfoEO.getStandYear())){
addStandNumber = sarStandardsInfoEO.getStandSort()+" " +sarStandardsInfoEO.getStandNumber()+"-"+sarStandardsInfoEO.getStandYear();
} else {
addStandNumber = sarStandardsInfoEO.getStandSort()+" " +sarStandardsInfoEO.getStandNumber();
}
if (StringUtils.isNotBlank(addStandNumber)) {
String relateStand = "";
if ("CBBH".equals(upField)) {
relateStand = sarStandardsInfoEO.getRelateStand();
}
List<String> newStandIdList = new ArrayList<>();
if (StringUtils.isNotBlank(relateStand)) {
List<String> newRealteStandList = Arrays.asList(relateStand.split(","));
for (String newRelate : newRealteStandList) {
SarStandardsInfo selectEO = new SarStandardsInfo();
selectEO.setStandNumber(newRelate);
List<SarStandardsInfo> result = dao.selectStandardsByStandnumber(selectEO);
// 新增关联
if (result != null && result.size()>0) {
String standId = result.get(0).getId();
newStandIdList.add(standId);
String relatedStand = sarStandAttrInfoEODao.selectFieldValByStandId(upField,standId);
String changeStand = "";
if(StringUtils.isNotBlank(relatedStand)){
List beforelist = new ArrayList<>(Arrays.asList(relatedStand.split(",")));
if (!beforelist.contains(addStandNumber)){
beforelist.add(addStandNumber);
changeStand = StringUtils.join(beforelist.toArray(), ",");
sarStandAttrInfoEODao.updateStandInfo(standId,upField,changeStand);
} else {
continue;
}
} else {
sarStandAttrInfoEODao.updateStandInfo(standId,upField,addStandNumber);
}
}
}
}
//查询对应当前标准的数据,删除关联
if (newStandIdList == null || newStandIdList.size() < 1) {
newStandIdList = null;
}
List<SelectionResult> resultList = sarStandAttrInfoEODao.selectFieldValByContainsVal(upField,addStandNumber,newStandIdList);
if (resultList != null && !resultList.isEmpty()) {
for (SelectionResult result : resultList) {
String relatedStand = result.getLabel();
List beforlist = new ArrayList<>(Arrays.asList(relatedStand.split(",")));
beforlist.remove(addStandNumber);
if (beforlist != null && !beforlist.isEmpty()) {
relatedStand = StringUtils.join(beforlist.toArray(), ",");
} else {
relatedStand = "";
}
sarStandAttrInfoEODao.updateStandInfo(result.getValue(),upField,relatedStand);
}
}
}
}
/**
* 代替标准号修改状态
* @param sarStandardsInfoEO
*/
public void replaseStandState(SarStandardsInfo sarStandardsInfoEO) throws Exception {
String newCiteStand = sarStandardsInfoEO.getReplaceStandNum();
if(StringUtils.isNotBlank(newCiteStand)){
String nowEOrepNums[] = newCiteStand.split(",");
for (String citeStand: nowEOrepNums){
SarStandardsInfo sarStandardsSelectEO =new SarStandardsInfo();
sarStandardsSelectEO.setStandNumber(citeStand);
List<SarStandardsInfo> result = dao.selectStandardsByStandnumber(sarStandardsSelectEO);
if (result != null && !result.isEmpty()){
SarStandardsInfo replaseStand = result.get(0);
String standState = replaseStand.getStandState();
String oldStandState = standState;
String oldStandStateShow = SarStandStateEnum.getLableByVal(oldStandState);
if(!SarStandStateEnum.N5KLTFLNRC.getValue().equals(standState)|| !SarStandStateEnum.TOVOID.getValue().equals(standState)){
replaseStand.setStandState(SarStandStateEnum.N5KLTFLNRC.getValue());
dao.updateById(replaseStand);
//更新log日志
sarUpdLogEOService.createBaseLog(replaseStand.getId(),replaseStand.getStandType()+"_STAND","入库流程当前标准因被新标准代替修改标准状态的值从《"+oldStandStateShow+"》为《\"已修订\"");
}
}
}
}
}
public void updateStandState (SarStandardsInfo sarStandardsInfoEO,String oldState) {
String resultState = "";
String newState = sarStandardsInfoEO.getStandState();
String standNum = "";
List<String> selectList = InitStandAttrUtil.standStateList;
if (org.apache.commons.lang.StringUtils.isNotBlank(sarStandardsInfoEO.getStandYear())) {
standNum = sarStandardsInfoEO.getStandSort() + " " + sarStandardsInfoEO.getStandNumber() + "-" + sarStandardsInfoEO.getStandYear();
} else {
standNum = sarStandardsInfoEO.getStandSort() + " " + sarStandardsInfoEO.getStandNumber();
}
// 根据数据信息判断当前应该状态
if (!SarStandStateEnum.ZTXXYX.getValue().equals(newState)) {
// 查询当前标准被代替信息
List<String> countRep = dao.countReplaceMsg(standNum);
int countFB = 0;
int countQT = 0;
if (countRep != null && !countRep.isEmpty()) {
for (String state : countRep) {
if (SarStandStateEnum.FJNVYX9Q7J.getValue().equals(state)) {
countFB ++;
break;
} else if (selectList.indexOf(state) < selectList.indexOf(SarStandStateEnum.FJNVYX9Q7J.getValue())) {
countQT ++;
}
}
}
if (countFB > 0) {
// newState = SarStandStateEnum.TOVOID.getValue();
} else if (countQT > 0) {
newState = SarStandStateEnum.ZTJJSS.getValue();
} else {
// 查询各个文件稿状态
Map<String,String> sarStandAttrMap = JSONObject.fromObject(sarStandardsInfoEO.getSarStandAttrEOStr());
if (sarStandAttrMap != null && !sarStandAttrMap.isEmpty()) {
if (StringUtils.isNotBlank(sarStandAttrMap.get("FBGBJBD"))) {
newState = SarStandStateEnum.FJNVYX9Q7J.getValue();
} else if (StringUtils.isNotBlank(sarStandAttrMap.get("SSG"))) {
newState = SarStandStateEnum.SUBMIT.getValue();
} else if (StringUtils.isNotBlank(sarStandAttrMap.get("BPG"))) {
newState = SarStandStateEnum.RADYSUBMIT.getValue();
} else if (StringUtils.isNotBlank(sarStandAttrMap.get("ZQYJG"))) {
newState = SarStandStateEnum.ADVICE.getValue();
} else if (StringUtils.isNotBlank(sarStandAttrMap.get("CA"))) {
newState = SarStandStateEnum.DRAFT.getValue();
}
}
}
}
// 与旧状态对比,判断是否修改
if (StringUtils.isNotBlank(oldState)) {
int newIndex = selectList.indexOf(newState);
int endIndex = selectList.indexOf(oldState);
if (newIndex < endIndex) {
resultState = oldState;
} else {
resultState = newState;
}
} else {
resultState = newState;
}
sarStandardsInfoEO.setStandState(resultState);
}
}
@@ -0,0 +1,23 @@
package com.adc.da.slrs.sarUpdLog.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.adc.da.slrs.sarUpdLog.entity.SarUpdLog;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.adc.da.base.web.BaseController;
/**
* <p>
* 前端控制器
* </p>
*
* @author super_liu
* @since 2021-06-01
*/
@RestController
@Api(description = "|SarUpdLog|")
@RequestMapping("/SarUpdLog/sar-upd-log")
public class SarUpdLogController extends BaseController<SarUpdLog> {
}
@@ -0,0 +1,16 @@
package com.adc.da.slrs.sarUpdLog.dao;
import com.adc.da.slrs.sarUpdLog.entity.SarUpdLog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author super_liu
* @since 2021-06-01
*/
public interface SarUpdLogDao extends BaseMapper<SarUpdLog> {
}
@@ -0,0 +1,54 @@
package com.adc.da.slrs.sarUpdLog.entity;
import com.adc.da.base.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableId;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author super_liu
* @since 2021-06-01
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="SarUpdLog对象", description="")
public class SarUpdLog extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId("ID")
private String id;
@ApiModelProperty(value = "数据类型")
@TableField("SAR_TYPE")
private String sarType;
@ApiModelProperty(value = "数据id")
@TableField("SAR_ID")
private String sarId;
@ApiModelProperty(value = "更新内容")
@TableField("CONTENT")
private String content;
@ApiModelProperty(value = "创建时间")
@TableField("CREATION_TIME")
private Date creationTime;
@TableField("CREATION_USER")
private String creationUser;
}
@@ -0,0 +1,21 @@
package com.adc.da.slrs.sarUpdLog.service;
import com.adc.da.slrs.sarUpdLog.entity.SarUpdLog;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.Map;
/**
* <p>
* 服务类
* </p>
*
* @author super_liu
* @since 2021-06-01
*/
public interface ISarUpdLogService extends IService<SarUpdLog> {
void createBaseLog(String sarId, String sarType, String content) throws Exception;
void createUpdateLog(String sarType, String sarId, Map<String, Object> oldMap, Map<String, Object> newMap, String standContent) throws Exception;
}
@@ -0,0 +1,259 @@
package com.adc.da.slrs.sarUpdLog.service.impl;
import com.adc.da.common.SarTypeEnum;
import com.adc.da.slrs.sarStandAttrDetails.dao.SarStandAttrDetailsDao;
import com.adc.da.slrs.sarUpdLog.entity.SarUpdLog;
import com.adc.da.slrs.sarUpdLog.dao.SarUpdLogDao;
import com.adc.da.slrs.sarUpdLog.service.ISarUpdLogService;
import com.adc.da.slrs.sysInfo.service.SysInfoEOService;
import com.adc.da.util.LoginUserUtil;
import com.adc.da.util.UUIDUtils;
import com.adc.da.utils.util.DateUtil;
import com.adc.da.utils.util.InitStandAttrUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
/**
* <p>
* 服务实现类
* </p>
*
* @author super_liu
* @since 2021-06-01
*/
@Service
public class SarUpdLogServiceImpl extends ServiceImpl<SarUpdLogDao, SarUpdLog> implements ISarUpdLogService {
private static final Logger logger = LoggerFactory.getLogger(SarUpdLogServiceImpl.class);
@Autowired
private SarUpdLogDao dao;
public SarUpdLogDao getDao() {
return dao;
}
@Autowired
private SarStandAttrDetailsDao sarStandAttrDetailsEODao;
@Autowired
private SysInfoEOService sysInfoEOService;
private String notCheckField = "XGLC,CHJL"; //不检测的是否修改字段
private List<String> notCheckFieldList = Arrays.asList(notCheckField.split(","));
public void createUpdateLog (String sarType, String sarId, Map<String,Object> oldMap, Map<String,Object> newMap,String standContent) throws Exception {
SarUpdLog sarUpdLogEO = new SarUpdLog();
sarUpdLogEO.setId(UUIDUtils.randomUUID20());
sarUpdLogEO.setSarId(sarId);
sarUpdLogEO.setSarType(sarType);
sarUpdLogEO.setCreationTime(new Date());
sarUpdLogEO.setCreationUser(LoginUserUtil.getUserId());
// 比对两个map组成content
String content = createStandContent(oldMap,newMap,sarType,standContent);
if (StringUtils.isNotBlank(content)) {
sarUpdLogEO.setContent(content);
dao.insert(sarUpdLogEO);
}
}
public String createStandContent (Map<String,Object> oldMap, Map<String,Object> newMap,String sarType,String standContent) throws Exception{
String content = "";
StringBuilder contentBuider = new StringBuilder();
for (Map.Entry<String,Object> entry : oldMap.entrySet()) {
String label = entry.getKey();
String value = String.valueOf(entry.getValue());
String newValue = String.valueOf(newMap.get(label));
if (StringUtils.isNotBlank(newValue) && label.equals("EOPSSRQ") && newValue.length()>10) {
newValue = DateUtil.formatStrUTCToDateStr(newValue);
}
List<String> allTimeField = new ArrayList<>();
allTimeField.addAll(InitStandAttrUtil.timeFieldList);
allTimeField.addAll(InitStandAttrUtil.timeFieldListLaws);
allTimeField.addAll(InitStandAttrUtil.timeFieldListBuss);
if (allTimeField.contains(label)) {
if (StringUtils.isNotBlank(value) && value.length() > 10) {
value = value.substring(0,10);
}
if (StringUtils.isNotBlank(newValue) && newValue.length() > 10) {
newValue = newValue.substring(0,10);
}
}
boolean item3 = !("null".equals(value) && StringUtils.isBlank(newValue));
boolean item4 = !("null".equals(newValue) && StringUtils.isBlank(value));
if (!StringUtils.equals(value,newValue) && !notCheckFieldList.contains(label) && item3 && item4) {
String fieldName = "";
if (SarTypeEnum.INLAND_STAND.getValue().equals(sarType) || SarTypeEnum.FOREIGN_STAND.getValue().equals(sarType)) {
fieldName = changeStandName(label,sarType);
} else if (SarTypeEnum.INLAND_LAWS.getValue().equals(sarType) || SarTypeEnum.FOREIGN_LAWS.getValue().equals(sarType)) {
fieldName = changeLawsName(label,sarType);
} else if (SarTypeEnum.BUSINESS.getValue().equals(sarType)) {
fieldName = changeBussName(label,sarType);
}
value = changeVal(label,value,sarType);
newValue = changeVal(label,newValue,sarType);
if ("null".equals(value) || StringUtils.isBlank(value)) {
value = "";
}
if ("null".equals(newValue) || StringUtils.isBlank(newValue)) {
newValue = "";
}
String con = "" + fieldName + "”由“" + value + "”改为“" + newValue + "”;";
// String con = "“" + fieldName + "”";
if (StringUtils.isNotBlank(fieldName) && !"null".equals(fieldName)) {
contentBuider.append(con);
}
}
}
if (contentBuider != null && contentBuider.length() > 0) {
content += "修改" + standContent + "";
}
content += contentBuider.toString();
return content;
}
public String changeVal (String field,String value,String sarType) {
if (StringUtils.isNotBlank(value)) {
Map<String,String> selectFieldMap = new HashMap<>();
String selVal = "";
if (SarTypeEnum.INLAND_STAND.getValue().equals(sarType) || SarTypeEnum.FOREIGN_STAND.getValue().equals(sarType)) {
selectFieldMap = InitStandAttrUtil.selectFieldMap;
selectFieldMap.put("isRelateAccess","SHIFOUGL");
selectFieldMap.put("country","COUNTRY");
selectFieldMap.put("standSort","STANDCLASSIFY");
selectFieldMap.put("standState","STANDSTATE");
} else if (SarTypeEnum.INLAND_LAWS.getValue().equals(sarType) || SarTypeEnum.FOREIGN_LAWS.getValue().equals(sarType)) {
selectFieldMap = InitStandAttrUtil.selectFieldMapLaws;
selectFieldMap.put("isRelateAccess","SHIFOUGL");
selectFieldMap.put("country","COUNTRY");
selectFieldMap.put("standSort","STANDCLASSIFY");
selectFieldMap.put("standState","STANDSTATE");
} else if (SarTypeEnum.BUSINESS.getValue().equals(sarType)) {
selectFieldMap = InitStandAttrUtil.selectFieldMapBuss;
selectFieldMap.put("standSort","BUSSSTANDCLASS");
selectFieldMap.put("standState","STANDSTATE");
}
selVal = selectFieldMap.get(field);
if (StringUtils.isNotBlank(selVal)) {
value = getSelectionValueName(selVal,value);
} else {
List<String> fileList = new ArrayList<>();
if (SarTypeEnum.INLAND_STAND.getValue().equals(sarType) || SarTypeEnum.FOREIGN_STAND.getValue().equals(sarType)) {
fileList = InitStandAttrUtil.fileFieldList;
} else if (SarTypeEnum.INLAND_LAWS.getValue().equals(sarType) || SarTypeEnum.FOREIGN_LAWS.getValue().equals(sarType)) {
fileList = InitStandAttrUtil.fileFieldListLaws;
} else if (SarTypeEnum.BUSINESS.getValue().equals(sarType)) {
fileList = InitStandAttrUtil.fileFieldListBuss;
}
if (fileList != null && fileList.contains(field)) {
value = sysInfoEOService.getFileNamesByIds(value);
}
}
}
return value;
}
public String getSelectionValueName (String selVal,String value) {
switch (selVal) {
case "SVPPS":
value = sysInfoEOService.getSvppsNamesByIds(value);
return value;
case "GZZXX":
value = sysInfoEOService.getGroupNamesByIds(value);
return value;
case "USERLIST":
value = sysInfoEOService.getUserNamesByIds(value);
return value;
case "ORGLIST":
value = sysInfoEOService.getOrgNamesByIds(value);
return value;
case "ROLELIST":
value = sysInfoEOService.getRoleNamesByIds(value);
return value;
case "SHIFOUGL":
if ("1".equals(value)) {
value = "";
} else if ("0".equals(value)) {
value = "";
}
return value;
default:
value = sysInfoEOService.getDicNamesByCodes(value);
return value;
}
}
public String changeStandName (String field,String sarType) throws Exception{
switch (field) {
case "country": return "适用区域";
case "isRelateAccess": return "重要度";
case "issueTime": return "发布日期";
case "standYear": return "标准年份";
case "standNature": return "标准性质";
case "standEnName": return "英文名称";
case "standName": return "中文名称";
case "standNumber": return "标准编号";
case "standSort": return "标准类别";
case "standState": return "标准状态";
case "synopsis": return "文本说明";
default:
String name = sarStandAttrDetailsEODao.selectNameByField(field,sarType);
return name;
}
}
public String changeLawsName (String field,String sarType) throws Exception{
switch (field) {
case "country": return "适用区域";
case "isRelateAccess": return "重要度";
case "issueTime": return "发布日期";
case "standEnName": return "英文名称";
case "standName": return "中文名称";
case "standNumber": return "政策编号";
case "standState": return "政策状态";
case "replaceStandNum": return "代替政策编号";
default:
String name = sarStandAttrDetailsEODao.selectNameByField(field,sarType);
return name;
}
}
public String changeBussName (String field,String sarType) throws Exception{
switch (field) {
// case "country": return "适用区域";
// case "isRelateAccess": return "重要度";
case "issueTime": return "发布日期";
case "putTime": return "标准实施日期";
// case "standYear": return "标准年份";
// case "standNature": return "标准性质";
case "standEnName": return "英文名称";
case "standName": return "中文名称";
case "standNumber": return "标准编号";
case "standSort": return "企标类别";
case "standState": return "标准状态";
case "replaceStandNum": return "代替企标编号";
case "replacedStandNum": return "被代替企标编号";
default:
String name = sarStandAttrDetailsEODao.selectNameByField(field,"BUSS");
return name;
}
}
public void createBaseLog (String sarId,String sarType,String content) throws Exception {
SarUpdLog sarUpdLogEO = new SarUpdLog();
sarUpdLogEO.setId(UUIDUtils.randomUUID20());
sarUpdLogEO.setSarId(sarId);
sarUpdLogEO.setSarType(sarType);
sarUpdLogEO.setCreationTime(new Date());
sarUpdLogEO.setCreationUser(LoginUserUtil.getUserId());
sarUpdLogEO.setContent(content);
dao.insert(sarUpdLogEO);
}
}
@@ -0,0 +1,71 @@
<?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.adc.da.slrs.sarStandMenu.dao.SarStandMenuDao">
<!-- Result Map-->
<resultMap id="BaseResultMap" type="com.adc.da.slrs.sarStandMenu.entity.SarStandMenu" >
<id column="id" property="id" />
<result column="valid_flag" property="validFlag" />
<result column="menu_id" property="menuId" />
<result column="stand_id" property="standId" />
</resultMap>
<!-- SAR_STAND_MENU table all fields -->
<sql id="Base_Column_List" >
valid_flag, menu_id, stand_id, id
</sql>
<!-- 查询条件 -->
<sql id="Base_Where_Clause">
where 1=1
<trim suffixOverrides="," >
<if test="validFlag != null" >
and valid_flag = #{validFlag}
</if>
<if test="menuId != null" >
and menu_id = #{menuId}
</if>
<if test="standId != null" >
and stand_id = #{standId}
</if>
<if test="id != null" >
and id = #{id}
</if>
</trim>
</sql>
<delete id="deleteByStandId" parameterType="java.lang.String">
delete from SAR_STAND_MENU
where stand_id = #{value}
</delete>
<select id="selectMenuByMenuParentId" resultMap="BaseResultMap" parameterType="com.adc.da.slrs.sarStandMenu.entity.SarStandMenu">
select <include refid="Base_Column_List"/> from SAR_STAND_MENU
where stand_id = #{standId} and valid_flag=0
and MENU_ID in
<foreach collection="menuIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<update id="updateByStandIdAndMenuId" parameterType="com.adc.da.slrs.sarStandMenu.entity.SarStandMenu" >
update SAR_STAND_MENU
<set >
<if test="menuId != null" >
menu_id = #{menuId},
</if>
</set>
where stand_id = #{standId}
and MENU_ID in
<foreach collection="menuIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<delete id="deleteByStandIdAndMenuId" parameterType="com.adc.da.slrs.sarStandMenu.entity.SarStandMenu">
delete from SAR_STAND_MENU
where stand_id = #{standId, jdbcType=VARCHAR} and MENU_ID = #{menuId, jdbcType=VARCHAR}
</delete>
</mapper>
@@ -0,0 +1,5 @@
<?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.adc.da.slrs.sarUpdLog.dao.SarUpdLogDao">
</mapper>
@@ -0,0 +1,359 @@
<?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.adc.da.slrs.sarStandFile.dao.SarStandFileDao">
<!-- Result Map-->
<resultMap id="BaseResultMap" type="com.adc.da.slrs.sarStandFile.entity.SarStandFile" >
<id column="id" property="id" />
<result column="modify_time" property="modifyTime" />
<result column="creation_time" property="creationTime" />
<result column="valid_flag" property="validFlag" />
<result column="use_model" property="useModel" />
<result column="att_id" property="attId" />
<result column="ori_att_id" property="oriAttId" />
<result column="stand_id" property="standId" />
<result column="file_suffix" property="fileSuffix" />
<result column="file_name" property="fileName" />
<result column="stand_file_classify" property="standFileClassify" />
<result column="password" property="password" />
<result column="creation_user" property="creationUser" />
<result column="resId" property="resId" />
<result column="standNumber" property="standNumber" />
<result column="standName" property="standName" />
<result column="sarType" property="sarType" />
</resultMap>
<!-- SAR_STAND_FILE table all fields -->
<sql id="Base_Column_List" >
modify_time, creation_time, valid_flag, use_model, att_id, stand_id, id,file_suffix,file_name,stand_file_classify,
password,creation_user,ori_att_id
</sql>
<!-- 查询条件 -->
<sql id="Base_Where_Clause">
where 1=1
<trim suffixOverrides="," >
<if test="modifyTime != null" >
and modify_time ${modifyTimeOperator} #{modifyTime}
</if>
<if test="modifyTime1 != null" >
and modify_time &gt;= #{modifyTime1}
</if>
<if test="modifyTime2 != null" >
and modify_time &lt;= #{modifyTime2}
</if>
<if test="creationTime != null" >
and creation_time ${creationTimeOperator} #{creationTime}
</if>
<if test="creationTime1 != null" >
and creation_time &gt;= #{creationTime1}
</if>
<if test="creationTime2 != null" >
and creation_time &lt;= #{creationTime2}
</if>
<if test="validFlag != null" >
and valid_flag ${validFlagOperator} #{validFlag}
</if>
<if test="useModel != null" >
and use_model ${useModelOperator} #{useModel}
</if>
<if test="attId != null" >
and att_id ${attIdOperator} #{attId}
</if>
<if test="standId != null" >
and stand_id ${standIdOperator} #{standId}
</if>
<if test="id != null" >
and id ${idOperator} #{id}
</if>
</trim>
</sql>
<!-- 插入记录 -->
<insert id="insert" parameterType="com.adc.da.slrs.sarStandFile.entity.SarStandFile" >
<!-- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
SELECT SEQ_SAR_STAND_FILE.NEXTVAL FROM DUAL
</selectKey> -->
insert into SAR_STAND_FILE(<include refid="Base_Column_List" />)
values (#{modifyTime, jdbcType=TIMESTAMP}, #{creationTime, jdbcType=TIMESTAMP}, #{validFlag, jdbcType=INTEGER},
#{useModel, jdbcType=VARCHAR}, #{attId, jdbcType=VARCHAR}, #{standId, jdbcType=VARCHAR},
#{id, jdbcType=VARCHAR},#{fileSuffix, jdbcType=VARCHAR},#{fileName, jdbcType=VARCHAR},#{standFileClassify, jdbcType=VARCHAR},
#{password, jdbcType=VARCHAR},#{creationUser, jdbcType=VARCHAR})
</insert>
<!-- 动态插入记录 主键是序列 -->
<insert id="insertSelective" parameterType="com.adc.da.slrs.sarStandFile.entity.SarStandFile" >
insert into SAR_STAND_FILE
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="modifyTime != null" >modify_time,</if>
<if test="creationTime != null" >creation_time,</if>
<if test="validFlag != null" >valid_flag,</if>
<if test="useModel != null" >use_model,</if>
<if test="attId != null" >att_id,</if>
<if test="standId != null" >stand_id,</if>
<if test="id != null" >id,</if>
<if test="fileSuffix != null" >file_suffix,</if>
<if test="fileName != null" >file_name,</if>
<if test="standFileClassify != null" >stand_file_classify,</if>
<if test="password != null" >password,</if>
<if test="creationUser != null" >creation_user,</if>
<if test="oriAttId != null" >ori_att_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="modifyTime != null" >#{modifyTime, jdbcType=TIMESTAMP},</if>
<if test="creationTime != null" >#{creationTime, jdbcType=TIMESTAMP},</if>
<if test="validFlag != null" >#{validFlag, jdbcType=INTEGER},</if>
<if test="useModel != null" >#{useModel, jdbcType=VARCHAR},</if>
<if test="attId != null" >#{attId, jdbcType=VARCHAR},</if>
<if test="standId != null" >#{standId, jdbcType=VARCHAR},</if>
<if test="id != null" >#{id, jdbcType=VARCHAR},</if>
<if test="fileSuffix != null" >#{fileSuffix, jdbcType=VARCHAR},</if>
<if test="fileName != null" >#{fileName, jdbcType=VARCHAR},</if>
<if test="standFileClassify != null" >#{standFileClassify, jdbcType=VARCHAR},</if>
<if test="password != null" >#{password, jdbcType=VARCHAR},</if>
<if test="creationUser != null" >#{creationUser, jdbcType=VARCHAR},</if>
<if test="oriAttId != null" >#{oriAttId, jdbcType=VARCHAR},</if>
</trim>
</insert>
<!-- 修改记录,只修改只不为空的字段 -->
<update id="updateByPrimaryKeySelective" parameterType="com.adc.da.slrs.sarStandFile.entity.SarStandFile" >
update SAR_STAND_FILE
<set >
<if test="oriAttId != null" >
ori_att_id = #{oriAttId},
</if>
<if test="modifyTime != null" >
modify_time = #{modifyTime},
</if>
<if test="creationTime != null" >
creation_time = #{creationTime},
</if>
<if test="validFlag != null" >
valid_flag = #{validFlag},
</if>
<if test="useModel != null" >
use_model = #{useModel},
</if>
<if test="attId != null" >
att_id = #{attId},
</if>
<if test="standId != null" >
stand_id = #{standId},
</if>
</set>
where id = #{id}
</update>
<!-- 根据id查询 SAR_STAND_FILE -->
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
select <include refid="Base_Column_List" />
from SAR_STAND_FILE
where id = #{value} and valid_flag=0
</select>
<!-- 删除记录 -->
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from SAR_STAND_FILE
where id = #{value}
</delete>
<!-- SAR_STAND_FILE 列表总数-->
<select id="queryByCount" resultType="java.lang.Integer" parameterType="com.adc.da.base.page.BasePage">
select count(1) from SAR_STAND_FILE
<include refid="Base_Where_Clause"/>
</select>
<!-- 查询SAR_STAND_FILE列表 -->
<select id="queryByPage" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
select <include refid="Base_Column_List" /> from
(select tmp_tb.* from
(select <include refid="Base_Column_List" /> from SAR_STAND_FILE
<include refid="Base_Where_Clause"/>
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
${pager.orderCondition}
</if>
) tmp_tb limit ${pager.startIndex-1},${pageSize}}) a
</select>
<select id="queryByList" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
select <include refid="Base_Column_List"/> from SAR_STAND_FILE
<include refid="Base_Where_Clause"/>
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
${pager.orderCondition}
</if>
</select>
<select id="selectFileByStandId" resultMap="BaseResultMap" parameterType="java.lang.String">
select <include refid="Base_Column_List" />
from SAR_STAND_FILE
where stand_id = #{value} and valid_flag = 0
</select>
<select id="selectFileByAttId" resultMap="BaseResultMap" parameterType="java.lang.String">
select <include refid="Base_Column_List" />
from SAR_STAND_FILE
where valid_flag = 0
and stand_id = (
select stand_id
from SAR_STAND_FILE
where att_id = #{value} and valid_flag = 0 and use_model = 'SOURCE_FILE'
limit 0,1
)
and use_model = 'WEB_FILE'
and ori_att_id = #{value}
order by modify_time desc
</select>
<!-- gaoyan 根据resid 查询 -->
<select id="selectFileByResId" resultMap="BaseResultMap" parameterType="com.adc.da.slrs.sarStandFile.entity.SarStandFile">
select <include refid="Base_Column_List" />
from SAR_STAND_FILE
where use_model = 'SOURCE_FILE'
</select>
<select id="selectFileMsgByAttId" resultMap="BaseResultMap" parameterType="java.lang.String">
select <include refid="Base_Column_List" />
from SAR_STAND_FILE
where valid_flag = 0
and att_id = #{value}
</select>
<select id="selectFileByStandIdAndId" resultMap="BaseResultMap" parameterType="com.adc.da.slrs.sarStandFile.entity.SarStandFile">
select <include refid="Base_Column_List" />
from SAR_STAND_FILE
where valid_flag = 0
<if test="standId != null" >
and stand_id = #{standId}
</if>
<if test="idlist != null">
and id not in
<foreach collection="idlist" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<delete id="deleteByStandId" parameterType="java.lang.String">
delete from SAR_STAND_FILE
where stand_id = #{value}
</delete>
<insert id="insertForeach" parameterType="java.util.List">
insert into SAR_STAND_FILE
(<include refid="Base_Column_List" />)
values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.modifyTime, jdbcType=TIMESTAMP},
#{item.creationTime, jdbcType=TIMESTAMP},
#{item.validFlag, jdbcType=INTEGER},
#{item.useModel, jdbcType=VARCHAR},
#{item.attId, jdbcType=VARCHAR},
#{item.standId, jdbcType=VARCHAR},
#{item.id, jdbcType=VARCHAR},
#{item.fileSuffix, jdbcType=VARCHAR},
#{item.fileName, jdbcType=VARCHAR},
#{item.standFileClassify, jdbcType=VARCHAR},
#{item.password, jdbcType=VARCHAR},
#{item.creationUser, jdbcType=VARCHAR},
#{item.oriAttId, jdbcType=VARCHAR})
</foreach>
</insert>
<select id="getStandFileListByPage" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
select * from
(select tmp_tb.* from
(
SELECT
SAR_STAND_FILE.id AS resId,
SAR_STAND_FILE.stand_id,
SAR_STAND_FILE.STAND_FILE_CLASSIFY,
SAR_STAND_FILE.file_name,
(
if(
SAR_STANDARDS_INFO.STAND_YEAR='',
CONCAT(SAR_STANDARDS_INFO.stand_sort,' ',SAR_STANDARDS_INFO.stand_number),
CONCAT(SAR_STANDARDS_INFO.stand_sort,' ',SAR_STANDARDS_INFO.stand_number,'-',SAR_STANDARDS_INFO.stand_year)
) ) AS standNumber,
SAR_STANDARDS_INFO.stand_name as standName,
SAR_STAND_FILE.att_id AS attId,
SAR_STANDARDS_INFO.STAND_TYPE as sarType
FROM
SAR_STAND_FILE
LEFT JOIN SAR_STANDARDS_INFO ON ( SAR_STAND_FILE.STAND_ID = SAR_STANDARDS_INFO.ID AND SAR_STANDARDS_INFO.VALID_FLAG = 0 )
where SAR_STANDARDS_INFO.VALID_FLAG =0 and SAR_STAND_FILE.VALID_FLAG =0
<if test="fileSuffixList != null">
and SAR_STAND_FILE.file_suffix in
<foreach collection="fileSuffixList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="standNumber != null">
and
if(
SAR_STANDARDS_INFO.STAND_YEAR='',
CONCAT(SAR_STANDARDS_INFO.stand_sort,' ',SAR_STANDARDS_INFO.stand_number),
CONCAT(SAR_STANDARDS_INFO.stand_sort,' ',SAR_STANDARDS_INFO.stand_number,'-',SAR_STANDARDS_INFO.stand_year)
) like concat(concat('%',#{standNumber}),'%')
</if>
<if test="standName != null">
and SAR_STANDARDS_INFO.stand_name like concat(concat ('%',#{standName}),'%')
</if>
<if test="standFileClassify != null">
and SAR_STAND_FILE.STAND_FILE_CLASSIFY = #{standFileClassify}
</if>
<if test="fileType != null">
and SAR_STANDARDS_INFO.STAND_TYPE = #{fileType}
</if>
order by SAR_STAND_FILE.modify_time desc,SAR_STAND_FILE.id
) tmp_tb limit ${pager.startIndex-1},${pageSize}) a
</select>
<select id="queryStandFileListByCount" resultType="java.lang.Integer" parameterType="com.adc.da.base.page.BasePage">
select count(1) from (
SELECT
SAR_STAND_FILE.id AS resId,
SAR_STAND_FILE.stand_id,
SAR_STAND_FILE.STAND_FILE_CLASSIFY,
SAR_STAND_FILE.file_name,
(
if(
SAR_STANDARDS_INFO.STAND_YEAR='',
CONCAT(SAR_STANDARDS_INFO.stand_sort,' ',SAR_STANDARDS_INFO.stand_number),
CONCAT(SAR_STANDARDS_INFO.stand_sort,' ',SAR_STANDARDS_INFO.stand_number,'-',SAR_STANDARDS_INFO.stand_year)
) ) AS standNumber,
SAR_STANDARDS_INFO.stand_name as standName,
SAR_STAND_FILE.att_id AS attId,
SAR_STANDARDS_INFO.STAND_TYPE as sarType
FROM
SAR_STAND_FILE
LEFT JOIN SAR_STANDARDS_INFO ON ( SAR_STAND_FILE.STAND_ID = SAR_STANDARDS_INFO.ID AND SAR_STANDARDS_INFO.VALID_FLAG = 0 )
where SAR_STANDARDS_INFO.VALID_FLAG =0 and SAR_STAND_FILE.VALID_FLAG =0
<if test="fileSuffixList != null">
and SAR_STAND_FILE.file_suffix in
<foreach collection="fileSuffixList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="standNumber != null">
and if(
SAR_STANDARDS_INFO.STAND_YEAR='',
CONCAT(SAR_STANDARDS_INFO.stand_sort,' ',SAR_STANDARDS_INFO.stand_number),
CONCAT(SAR_STANDARDS_INFO.stand_sort,' ',SAR_STANDARDS_INFO.stand_number,'-',SAR_STANDARDS_INFO.stand_year)
) like concat(concat('%',#{standNumber}),'%')
</if>
<if test="standName != null">
and SAR_STANDARDS_INFO.stand_name like concat(concat ('%',#{standName}),'%')
</if>
<if test="standFileClassify != null">
and SAR_STAND_FILE.STAND_FILE_CLASSIFY = #{standFileClassify}
</if>
<if test="fileType != null">
and SAR_STANDARDS_INFO.STAND_TYPE = #{fileType}
</if>
) r
</select>
</mapper>
@@ -0,0 +1,80 @@
<?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.adc.da.slrs.sarStandPutTime.dao.SarStandPutTimeDao">
<!-- Result Map-->
<resultMap id="BaseResultMap" type="com.adc.da.slrs.sarStandPutTime.entity.SarStandPutTime" >
<id column="id" property="id" />
<result column="stand_id" property="standId" />
<result column="time_name" property="timeName" />
<result column="put_time" property="putTime" />
<result column="time_type" property="timeType" />
<result column="order_num" property="orderNum" />
<result column="creation_time" property="creationTime" />
</resultMap>
<!-- SAR_STAND_PUT_TIME table all fields -->
<sql id="Base_Column_List" >
id, stand_id, time_name, put_time, time_type, order_num, creation_time
</sql>
<!-- 查询条件 -->
<sql id="Base_Where_Clause">
where 1=1
<trim suffixOverrides="," >
<if test="id != null" >
and id ${idOperator} #{id}
</if>
<if test="standId != null" >
and stand_id ${standIdOperator} #{standId}
</if>
<if test="timeName != null" >
and time_name ${timeNameOperator} #{timeName}
</if>
<if test="putTime != null" >
and put_time ${putTimeOperator} #{putTime}
</if>
<if test="putTime1 != null" >
and put_time &gt;= #{putTime1}
</if>
<if test="putTime2 != null" >
and put_time &lt;= #{putTime2}
</if>
<if test="timeType != null" >
and time_type ${timeTypeOperator} #{timeType}
</if>
<if test="orderNum != null" >
and order_num ${orderNumOperator} #{orderNum}
</if>
<if test="creationTime != null" >
and creation_time ${creationTimeOperator} #{creationTime}
</if>
<if test="creationTime1 != null" >
and creation_time &gt;= #{creationTime1}
</if>
<if test="creationTime2 != null" >
and creation_time &lt;= #{creationTime2}
</if>
</trim>
</sql>
<delete id="deleteByStandId" parameterType="java.lang.String">
delete from SAR_STAND_PUT_TIME
where stand_id = #{value}
</delete>
<insert id="insertForeach" parameterType="java.util.List">
insert into SAR_STAND_PUT_TIME
(id, stand_id, time_name, put_time, time_type,creation_time)
values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.id, jdbcType=VARCHAR},
#{item.standId, jdbcType=VARCHAR},
#{item.timeName, jdbcType=VARCHAR},
#{item.putTime, jdbcType=VARCHAR},
#{item.timeType, jdbcType=VARCHAR},
#{item.creationTime, jdbcType=TIMESTAMP}
)
</foreach>
</insert>
</mapper>
@@ -0,0 +1,40 @@
<?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.adc.da.slrs.sarStandVal.dao.SarStandValDao">
<!-- Result Map-->
<resultMap id="BaseResultMap" type="com.adc.da.slrs.sarStandVal.entity.SarStandVal" >
<id column="id" property="id" />
<result column="modify_time" property="modifyTime" />
<result column="creation_time" property="creationTime" />
<result column="valid_flag" property="validFlag" />
<result column="property_val" property="propertyVal" />
<result column="property_type" property="propertyType" />
<result column="stand_id" property="standId" />
</resultMap>
<!-- SAR_STAND_VAL table all fields -->
<sql id="Base_Column_List" >
modify_time, creation_time, valid_flag, property_val, property_type, stand_id, id
</sql>
<delete id="deleteDataByStandid" parameterType="java.lang.String">
delete from SAR_STAND_VAL
where stand_id = #{standId}
</delete>
<insert id="insertForeach" parameterType="java.util.List">
insert into SAR_STAND_VAL
(<include refid="Base_Column_List" />)
values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.modifyTime, jdbcType=TIMESTAMP},
#{item.creationTime, jdbcType=TIMESTAMP},
#{item.validFlag, jdbcType=INTEGER},
#{item.propertyVal, jdbcType=VARCHAR},
#{item.propertyType, jdbcType=VARCHAR},
#{item.standId, jdbcType=VARCHAR},
#{item.id, jdbcType=VARCHAR})
</foreach>
</insert>
</mapper>
@@ -162,12 +162,6 @@
</trim>
</sql>
<!-- 插入记录 -->
<insert id="insert" parameterType="com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo" >
insert into SAR_STANDARDS_INFO(<include refid="Base_Column_List" />)
values (#{id, jdbcType=VARCHAR}, #{standType, jdbcType=VARCHAR}, #{country, jdbcType=VARCHAR}, #{standSort, jdbcType=VARCHAR}, #{standNumber, jdbcType=VARCHAR}, #{standYear, jdbcType=VARCHAR}, #{standName, jdbcType=VARCHAR}, #{standEnName, jdbcType=VARCHAR}, #{standState, jdbcType=VARCHAR}, #{standNature, jdbcType=VARCHAR}, #{issueTime, jdbcType=TIMESTAMP}, #{putTime, jdbcType=TIMESTAMP}, #{synopsis, jdbcType=CLOB}, #{replaceStandNum, jdbcType=CLOB}, #{replacedStandNum, jdbcType=VARCHAR}, #{creationUser, jdbcType=VARCHAR}, #{validFlag, jdbcType=VARCHAR}, #{creationTime, jdbcType=TIMESTAMP}, #{modifyTime, jdbcType=TIMESTAMP})
</insert>
<!-- 动态插入记录 主键是序列 -->
<insert id="insertSelective" parameterType="com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo" >
insert into SAR_STANDARDS_INFO