工程配置模块开发
This commit is contained in:
parent
b6cceb3004
commit
99e963a22f
|
|
@ -0,0 +1,88 @@
|
||||||
|
package com.bonus.bmw.controller;
|
||||||
|
|
||||||
|
import com.bonus.bmw.domain.dto.WebFileDto;
|
||||||
|
import com.bonus.bmw.domain.po.HomePagePo;
|
||||||
|
import com.bonus.bmw.domain.po.PmSub;
|
||||||
|
import com.bonus.bmw.domain.vo.PmWorker;
|
||||||
|
import com.bonus.bmw.domain.vo.TbProConfigVo;
|
||||||
|
import com.bonus.bmw.service.TbProConfigService;
|
||||||
|
import com.bonus.common.core.utils.encryption.Sm4Utils;
|
||||||
|
import com.bonus.common.core.utils.json.FastJsonHelper;
|
||||||
|
import com.bonus.common.core.web.controller.BaseController;
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.common.core.web.page.TableDataInfo;
|
||||||
|
import com.bonus.common.log.annotation.SysLog;
|
||||||
|
import com.bonus.common.log.enums.OperaType;
|
||||||
|
import com.bonus.common.security.annotation.InnerAuth;
|
||||||
|
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.bonus.common.security.annotation.RequiresPermissionsOrInnerAuth;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static com.bonus.bmw.utils.OwnPermissionUtil.dealWithPermission;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多工程入场 配置
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/proConfig")
|
||||||
|
public class TbProConfigController extends BaseController {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TbProConfigService service;
|
||||||
|
|
||||||
|
@GetMapping("/getConfigList")
|
||||||
|
@SysLog(title = "工程配置", businessType = OperaType.QUERY, logType = 0, module = "工程配置->工程配置", details = "工程配置列表查询")
|
||||||
|
public TableDataInfo getConfigList(TbProConfigVo homePagePo) {
|
||||||
|
try {
|
||||||
|
startPage();
|
||||||
|
List<TbProConfigVo> list = service.getConfigList(homePagePo);
|
||||||
|
return getDataTable(list);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e.toString(), e);
|
||||||
|
}
|
||||||
|
return getDataTableError(new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/insert")
|
||||||
|
@SysLog(title = "工程配置", businessType = OperaType.INSERT, logType = 0, module = "工程配置->工程配置->新增配置", details = "新增配置")
|
||||||
|
public AjaxResult insert(@RequestBody TbProConfigVo params) {
|
||||||
|
return service.insert(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/update")
|
||||||
|
@SysLog(title = "工程配置", businessType = OperaType.UPDATE, logType = 0, module = "工程配置->工程配置->新增配置", details = "修改配置")
|
||||||
|
public AjaxResult update(@RequestBody TbProConfigVo params) {
|
||||||
|
return service.update(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/delete")
|
||||||
|
@SysLog(title = "工程配置", businessType = OperaType.DELETE, logType = 0, module = "工程配置->工程配置->新增配置", details = "删除配置")
|
||||||
|
public AjaxResult delete(@RequestBody TbProConfigVo params) {
|
||||||
|
return service.delete(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多工程入场 默认无数据是 不可以
|
||||||
|
* 是否需要离场结算 无数据是需要
|
||||||
|
* 0 退场证明 1 是否可以多工程入场
|
||||||
|
* 必传 分公司id-工程类型 ,工程地区,type=>0 退场证明 1 是否可以多工程入场
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/getConfig")
|
||||||
|
@SysLog(title = "工程配置", businessType = OperaType.DELETE, logType = 0, module = "工程配置->工程配置->新增配置", details = "获取配置")
|
||||||
|
public AjaxResult getConfig(@RequestBody TbProConfigVo params) {
|
||||||
|
return service.getConfig(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.bonus.bmw.domain.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class TbProConfigVo {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
* 风公司id
|
||||||
|
*/
|
||||||
|
private String subId;
|
||||||
|
/**
|
||||||
|
* 分公司名称
|
||||||
|
*/
|
||||||
|
private String subName;
|
||||||
|
/**
|
||||||
|
* 工程区域
|
||||||
|
*/
|
||||||
|
private String proArea;
|
||||||
|
/**
|
||||||
|
* 数据类型0 退场证明 1 是否可以多工程入场
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
/**
|
||||||
|
* 工程类型
|
||||||
|
*/
|
||||||
|
private String proType;
|
||||||
|
/**
|
||||||
|
* 是否需要
|
||||||
|
*/
|
||||||
|
private String isNeed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关键字
|
||||||
|
*/
|
||||||
|
private String keyWord;
|
||||||
|
/**
|
||||||
|
* 配置id
|
||||||
|
*/
|
||||||
|
private String configId;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
package com.bonus.bmw.mapper;
|
||||||
|
|
||||||
|
import com.bonus.bmw.domain.vo.TbProConfigVo;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface TbProConfigMapper {
|
||||||
|
/**
|
||||||
|
* 查询工程配置信息
|
||||||
|
* @param vo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<TbProConfigVo> getConfigList(TbProConfigVo vo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询工程配置是否存在
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int getProConfig(TbProConfigVo params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插入数据
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int insert(TbProConfigVo params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增配置关联信息
|
||||||
|
* @param id
|
||||||
|
* @param subId
|
||||||
|
* @param isNeed
|
||||||
|
* @param type
|
||||||
|
* @param proAreaList
|
||||||
|
*/
|
||||||
|
void addProConfigReal(@Param("configId") String id,@Param("subId") String subId,@Param("proType")String proType, @Param("isNeed")String isNeed, @Param("type")String type, @Param("list")List<String> proAreaList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改配置
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int update(TbProConfigVo params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除配置
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
void delRealData(TbProConfigVo params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除失败
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int delete(TbProConfigVo params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询1配置信息
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
TbProConfigVo TbProConfigVo(TbProConfigVo params);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.bonus.bmw.service;
|
||||||
|
|
||||||
|
import com.bonus.bmw.domain.vo.TbProConfigVo;
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface TbProConfigService {
|
||||||
|
/**
|
||||||
|
* 查询工程配置列表集合
|
||||||
|
* @param homePagePo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<TbProConfigVo> getConfigList(TbProConfigVo homePagePo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增工程配置
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult insert(TbProConfigVo params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改配置
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult update(TbProConfigVo params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除配置
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult delete(TbProConfigVo params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 依据工程类型 ,分公司名称 ,工程地区查询
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult getConfig(TbProConfigVo params);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,153 @@
|
||||||
|
package com.bonus.bmw.service.impl;
|
||||||
|
|
||||||
|
import com.bonus.bmw.domain.vo.TbProConfigVo;
|
||||||
|
import com.bonus.bmw.mapper.TbProConfigMapper;
|
||||||
|
import com.bonus.bmw.service.TbProConfigService;
|
||||||
|
import com.bonus.common.core.utils.StringUtils;
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.checkerframework.checker.units.qual.A;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class TbProConfigServiceImpl implements TbProConfigService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TbProConfigMapper mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工程配置集合
|
||||||
|
* @param vo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<TbProConfigVo> getConfigList(TbProConfigVo vo) {
|
||||||
|
try{
|
||||||
|
return mapper.getConfigList(vo);
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error(e.toString(),e);
|
||||||
|
}
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult insert(TbProConfigVo params) {
|
||||||
|
try{
|
||||||
|
String proType=params.getProType();
|
||||||
|
String proArea=params.getProArea();
|
||||||
|
String type=params.getType();
|
||||||
|
if(StringUtils.isEmpty(proType)){
|
||||||
|
return AjaxResult.error("请选择工程类型");
|
||||||
|
}
|
||||||
|
if(StringUtils.isEmpty(proArea)){
|
||||||
|
return AjaxResult.error("请选择区域");
|
||||||
|
}
|
||||||
|
if(StringUtils.isEmpty(type)){
|
||||||
|
return AjaxResult.error("请选择配置类型");
|
||||||
|
}
|
||||||
|
int num=mapper.getProConfig(params);
|
||||||
|
if(num>0){
|
||||||
|
return AjaxResult.error("当前分包商配置已存在,请去修改");
|
||||||
|
}
|
||||||
|
List<String> proTypeList= Arrays.asList(proType.split(","));
|
||||||
|
List<String> proAreaList= Arrays.asList(proArea.split(","));
|
||||||
|
int success=mapper.insert(params);
|
||||||
|
if(success>0){
|
||||||
|
for (String proTypeData:proTypeList){
|
||||||
|
mapper.addProConfigReal(params.getId(),params.getSubId(),proTypeData,params.getIsNeed(),params.getType(),proAreaList);
|
||||||
|
}
|
||||||
|
return AjaxResult.success("添加成功");
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error(e.toString(),e);
|
||||||
|
}
|
||||||
|
return AjaxResult.error("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult update(TbProConfigVo params) {
|
||||||
|
try{
|
||||||
|
String proType=params.getProType();
|
||||||
|
String proArea=params.getProArea();
|
||||||
|
String type=params.getType();
|
||||||
|
if(StringUtils.isEmpty(proType)){
|
||||||
|
return AjaxResult.error("请选择工程类型");
|
||||||
|
}
|
||||||
|
if(StringUtils.isEmpty(proArea)){
|
||||||
|
return AjaxResult.error("请选择区域");
|
||||||
|
}
|
||||||
|
if(StringUtils.isEmpty(type)){
|
||||||
|
return AjaxResult.error("请选择配置类型");
|
||||||
|
}
|
||||||
|
int num=mapper.getProConfig(params);
|
||||||
|
if(num>0){
|
||||||
|
return AjaxResult.error("当前分包商配置已存在,请去修改");
|
||||||
|
}
|
||||||
|
List<String> proTypeList= Arrays.asList(proType.split(","));
|
||||||
|
List<String> proAreaList= Arrays.asList(proArea.split(","));
|
||||||
|
int success=mapper.update(params);
|
||||||
|
if(success>0){
|
||||||
|
mapper.delRealData(params);
|
||||||
|
for (String proTypeData:proTypeList){
|
||||||
|
mapper.addProConfigReal(params.getId(),params.getSubId(),proTypeData,params.getIsNeed(),params.getType(),proAreaList);
|
||||||
|
}
|
||||||
|
return AjaxResult.success("添加成功");
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error(e.toString(),e);
|
||||||
|
}
|
||||||
|
return AjaxResult.error("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除配置信息
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult delete(TbProConfigVo params) {
|
||||||
|
try{
|
||||||
|
int success=mapper.delete(params);
|
||||||
|
if(success>0){
|
||||||
|
mapper.delRealData(params);
|
||||||
|
return AjaxResult.success("删除成功");
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error(e.toString(),e);
|
||||||
|
}
|
||||||
|
return AjaxResult.error("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多工程入场 默认无数据是 不可以
|
||||||
|
* 是否需要离场结算 无数据是需要
|
||||||
|
* 0 退场证明 1 是否可以多工程入场
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult getConfig(TbProConfigVo params) {
|
||||||
|
try{
|
||||||
|
TbProConfigVo vo=mapper.TbProConfigVo(params);
|
||||||
|
if(vo!=null){
|
||||||
|
return AjaxResult.success(vo);
|
||||||
|
}else{
|
||||||
|
if("0".equals(params.getType())){
|
||||||
|
params.setIsNeed("1");
|
||||||
|
}else{
|
||||||
|
params.setIsNeed("0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return AjaxResult.success(params);
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error(e.toString(),e);
|
||||||
|
}
|
||||||
|
return AjaxResult.error("查询失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
<?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.bonus.bmw.mapper.TbProConfigMapper">
|
||||||
|
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||||
|
insert into tb_pro_config(
|
||||||
|
sub_id,sub_name, pro_type, pro_area, type,is_need
|
||||||
|
)values (#{subId},#{subName},#{proType},#{proArea},#{type},#{isNeed})
|
||||||
|
</insert>
|
||||||
|
<insert id="addProConfigReal">
|
||||||
|
insert into tb_pro_config_real(config_id, sub_id, pro_type, pro_area, is_need, type)
|
||||||
|
values
|
||||||
|
<foreach item="item" collection="list" separator="," index="index" >
|
||||||
|
(#{configId},#{subId},#{proType},#{item},#{isNeed},#{type}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
<update id="update">
|
||||||
|
update tb_pro_config set sub_id=#{subId} ,sub_name=#{subName},pro_type=#{proType},pro_area=#{proArea},type=#{type},is_need=#{isNeed}
|
||||||
|
where id=#{id}
|
||||||
|
</update>
|
||||||
|
<delete id="delRealData">
|
||||||
|
delete from tb_pro_config_real where config_id=#{id}
|
||||||
|
</delete>
|
||||||
|
<delete id="delete">
|
||||||
|
delete from tb_pro_config where id=#{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<select id="getConfigList" resultType="com.bonus.bmw.domain.vo.TbProConfigVo">
|
||||||
|
select id,sub_id subId,sub_name subName,pro_type proType,pro_area proArea,type,is_need isNeed
|
||||||
|
from tb_pro_config
|
||||||
|
<where>
|
||||||
|
<if test="subName!=null and subName!=''">
|
||||||
|
and sub_name like concat('%',#{subName},'%')
|
||||||
|
</if>
|
||||||
|
<if test="keyWord!=null and keyWord!=''">
|
||||||
|
and(
|
||||||
|
pro_area like concat('%',#{keyWord},'%') OR
|
||||||
|
pro_type like concat('%',#{keyWord},'%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
<select id="getProConfig" resultType="java.lang.Integer">
|
||||||
|
select count(1)
|
||||||
|
from tb_pro_config
|
||||||
|
where sub_id=#{subId} and type=#{type}
|
||||||
|
<if test="id!=null and id!=''">
|
||||||
|
and id!=#{id}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
<select id="TbProConfigVo" resultType="com.bonus.bmw.domain.vo.TbProConfigVo">
|
||||||
|
select id,sub_id subId,pro_type proType,pro_area proArea,type,is_need isNeed,config_id configId
|
||||||
|
from tb_pro_config_real
|
||||||
|
where pro_type=#{proType} and sub_id=#{subId} and pro_area=#{proArea} and type=#{type}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue