ezhizao_zx 1 year ago
parent
commit
f00941accc

+ 2 - 2
src/main/java/cn/ezhizao/framework/web/domain/BaseEntity.java

@@ -40,7 +40,7 @@ public class BaseEntity implements Serializable
     /** 创建时间 */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @TableField(value="create_time",fill= FieldFill.INSERT)
-    @Excel(name = "发单日期", width = 30, dateFormat = "yyyy-MM-dd",sort = 6)
+//    @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd",sort = 6)
     private Date createTime;
 
     /** 更新者 */
@@ -71,7 +71,7 @@ public class BaseEntity implements Serializable
     private Date updateTime;
 
     /** 备注 */
-    @Excel(name = "备注")
+//    @Excel(name = "备注", sort = 99)
     private String remark;
 
     /** 请求参数 */

+ 17 - 3
src/main/java/cn/ezhizao/project/business/reconciliation/priceList/controller/BizEntrustOncePriceController.java

@@ -1,9 +1,11 @@
 package cn.ezhizao.project.business.reconciliation.priceList.controller;
 
+import java.util.ArrayList;
 import java.util.List;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 
+import cn.ezhizao.project.business.reconciliation.priceList.domain.BizEntrustOnce;
 import cn.ezhizao.project.business.reconciliation.priceList.domain.BizEntrustPrice;
 import cn.ezhizao.project.business.reconciliation.priceList.service.IBizEntrustPriceService;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -52,9 +54,21 @@ public class BizEntrustOncePriceController extends BaseController {
     @Log(title = "单次价目表", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     public void export(HttpServletResponse response, BizEntrustPrice bizEntrustPrice) throws NoSuchFieldException, IllegalAccessException {
-        List<BizEntrustPrice> list = bizEntrustPriceService.getList(bizEntrustPrice);
-        ExcelUtil<BizEntrustPrice> util = new ExcelUtil<BizEntrustPrice>(BizEntrustPrice.class);
-        util.exportExcel(response, list, "单次价目表数据");
+        List<BizEntrustPrice> list = bizEntrustPriceService.getOnceList(bizEntrustPrice);
+        List<BizEntrustOnce> onceList =new ArrayList<>();
+        list.forEach(l -> {
+
+            BizEntrustOnce once = new BizEntrustOnce();
+            once.setRegion(l.getProvince() + "-" + l.getCity() + "-" + l.getDistrict());
+            once.setTaskTypeName(l.getTaskTypeName());
+            once.setTaskTypeDetailName(l.getTaskTypeId()==6?l.getAlterType()+"-"+l.getTaskTypeDetailName():l.getTaskTypeDetailName());
+            once.setPrice(l.getPrice());
+            once.setRemark(l.getRemark());
+            onceList.add(once);
+        });
+
+        ExcelUtil<BizEntrustOnce> util = new ExcelUtil<BizEntrustOnce>(BizEntrustOnce.class);
+        util.exportExcel(response, onceList, "单次价目表数据");
     }
 
     /**

+ 6 - 2
src/main/java/cn/ezhizao/project/business/reconciliation/priceList/controller/BizEntrustPriceController.java

@@ -51,12 +51,16 @@ public class BizEntrustPriceController extends BaseController {
      * 导出价目表系统列表
      */
     @PreAuthorize("@ss.hasPermi('priceList:priceList:export')")
-    @Log(title = "价目表系统", businessType = BusinessType.EXPORT)
+    @Log(title = "循环价目表", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     public void export(HttpServletResponse response, BizEntrustPrice bizEntrustPrice) throws NoSuchFieldException, IllegalAccessException {
         List<BizEntrustPrice> list = bizEntrustPriceService.getList(bizEntrustPrice);
+        list.forEach(l->{
+            l.setAnnualIncome(l.getTaskTypeId()==1?l.getAnnualIncome():"--");
+            l.setChanged((l.getTaskTypeId()==2||l.getTaskTypeId()==3)?l.getIsChanged()==0?"否":"是":"--");
+        });
         ExcelUtil<BizEntrustPrice> util = new ExcelUtil<BizEntrustPrice>(BizEntrustPrice.class);
-        util.exportExcel(response, list, "价目表系统数据");
+        util.exportExcel(response, list, "循环价目表数据");
     }
 
     /**

+ 137 - 0
src/main/java/cn/ezhizao/project/business/reconciliation/priceList/domain/BizEntrustOnce.java

@@ -0,0 +1,137 @@
+package cn.ezhizao.project.business.reconciliation.priceList.domain;
+
+import cn.ezhizao.framework.aspectj.lang.annotation.Excel;
+import cn.ezhizao.framework.web.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 价目表系统对象 biz_entrust_price
+ *
+ * @author ruoyi
+ * @date 2023-12-01
+ */
+@Data
+@TableName(value = "biz_entrust_price")
+public class BizEntrustOnce extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+
+
+    /** 任务类型外键 */
+    @ApiModelProperty(value = "任务类型")
+    private Long taskTypeId;
+
+
+
+    @Excel(name = "地区",width = 30)
+    @TableField(exist = false)
+    private  String region;
+
+    /** 任务类型名称 */
+    @Excel(name = "任务类型",width = 20)
+    @TableField(exist = false)
+    private String taskTypeName;
+
+    /** 任务变更类型 */
+    @ApiModelProperty(value = "变更任务")
+    private String alterType;
+
+    /** 任务明细名称 */
+    @Excel(name = "任务明细")
+    @TableField(exist = false)
+    private String taskTypeDetailName;
+
+    /** 单价 */
+    @Excel(name = "金额")
+    @ApiModelProperty(value = "单价")
+    private BigDecimal price;
+
+
+
+    /** 任务明细外键 */
+    @ApiModelProperty(value = "任务明细类型")
+    private Long taskTypeDetailId;
+
+    /** 年收入 */
+//    @Excel(name = "年收入")
+    @ApiModelProperty(value = "年收入")
+    private String annualIncome;
+
+    /** (社保/公积金)是否变更 */
+//    @Excel(name = "(社保/公积金)是否变更")
+    @ApiModelProperty(value = "(社保/公积金)是否变更")
+    private Integer isChanged;
+
+    /** (社保/公积金)是否变更 */
+//    @Excel(name = "是否变更")
+    @TableField(exist = false)
+    private String changed;
+
+    /** 备注 */
+    @Excel(name = "备注")
+    @ApiModelProperty(value = "备注")
+    private String remark;
+
+    /** 甲方租户 */
+//    @Excel(name = "甲方租户")
+    @ApiModelProperty(value = "甲方租户")
+    private Long fromTenantId;
+
+    /** 乙方租户 */
+//    @Excel(name = "乙方租户")
+    @ApiModelProperty(value = "乙方租户")
+    private Long toTenantId;
+
+    /** 省 */
+//    @Excel(name = "省")
+    @ApiModelProperty(value = "省")
+    private String province;
+
+    /** 注册省份编码 */
+//    @Excel(name = "注册省份编码")
+    @ApiModelProperty(value = "注册省份编码")
+    private String provinceCode;
+
+    /** 注册城市编码 */
+//    @Excel(name = "注册城市编码")
+    @ApiModelProperty(value = "注册城市编码")
+    private String cityCode;
+
+    /** 市 */
+//    @Excel(name = "市")
+    @ApiModelProperty(value = "市")
+    private String city;
+
+    /** 区 */
+//    @Excel(name = "区")
+    @ApiModelProperty(value = "区")
+    private String district;
+
+    /** 注册行政区编码 */
+//    @Excel(name = "注册行政区编码")
+    @ApiModelProperty(value = "注册行政区编码")
+    private String districtCode;
+
+    /** 甲方账户名称 */
+    @TableField(exist = false)
+    private String fromAccountName;
+
+    /** 乙方账户名称 */
+    @TableField(exist = false)
+    private String toAccountName;
+
+
+
+
+
+    @TableField(exist = false)
+    protected Long tenantId;
+
+
+}

+ 34 - 16
src/main/java/cn/ezhizao/project/business/reconciliation/priceList/domain/BizEntrustPrice.java

@@ -22,15 +22,22 @@ public class BizEntrustPrice extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
 
-    /** 单价 */
-    @Excel(name = "单价")
-    @ApiModelProperty(value = "单价")
-    private BigDecimal price;
+
 
     /** 任务类型外键 */
     @ApiModelProperty(value = "任务类型")
     private Long taskTypeId;
 
+    /** 任务类型名称 */
+    @Excel(name = "任务类型")
+    @TableField(exist = false)
+    private String taskTypeName;
+
+    /** 单价 */
+    @Excel(name = "单价")
+    @ApiModelProperty(value = "单价")
+    private BigDecimal price;
+
     /** 任务变更类型 */
     @ApiModelProperty(value = "变更任务")
     private String alterType;
@@ -45,47 +52,57 @@ public class BizEntrustPrice extends BaseEntity
     private String annualIncome;
 
     /** (社保/公积金)是否变更 */
-    @Excel(name = "(社保/公积金)是否变更")
+//    @Excel(name = "(社保/公积金)是否变更")
     @ApiModelProperty(value = "(社保/公积金)是否变更")
     private Integer isChanged;
 
+    /** (社保/公积金)是否变更 */
+    @Excel(name = "是否变更")
+    @TableField(exist = false)
+    private String changed;
+
+    /** 备注 */
+    @Excel(name = "备注")
+    @ApiModelProperty(value = "备注")
+    private String remark;
+
     /** 甲方租户 */
-    @Excel(name = "甲方租户")
+//    @Excel(name = "甲方租户")
     @ApiModelProperty(value = "甲方租户")
     private Long fromTenantId;
 
     /** 乙方租户 */
-    @Excel(name = "乙方租户")
+//    @Excel(name = "乙方租户")
     @ApiModelProperty(value = "乙方租户")
     private Long toTenantId;
 
     /** 省 */
-    @Excel(name = "省")
+//    @Excel(name = "省")
     @ApiModelProperty(value = "省")
     private String province;
 
     /** 注册省份编码 */
-    @Excel(name = "注册省份编码")
+//    @Excel(name = "注册省份编码")
     @ApiModelProperty(value = "注册省份编码")
     private String provinceCode;
 
     /** 注册城市编码 */
-    @Excel(name = "注册城市编码")
+//    @Excel(name = "注册城市编码")
     @ApiModelProperty(value = "注册城市编码")
     private String cityCode;
 
     /** 市 */
-    @Excel(name = "市")
+//    @Excel(name = "市")
     @ApiModelProperty(value = "市")
     private String city;
 
     /** 区 */
-    @Excel(name = "区")
+//    @Excel(name = "区")
     @ApiModelProperty(value = "区")
     private String district;
 
     /** 注册行政区编码 */
-    @Excel(name = "注册行政区编码")
+//    @Excel(name = "注册行政区编码")
     @ApiModelProperty(value = "注册行政区编码")
     private String districtCode;
 
@@ -97,9 +114,7 @@ public class BizEntrustPrice extends BaseEntity
     @TableField(exist = false)
     private String toAccountName;
 
-    /** 任务类型名称 */
-    @TableField(exist = false)
-    private String taskTypeName;
+
 
     /** 任务明细名称 */
     @TableField(exist = false)
@@ -107,4 +122,7 @@ public class BizEntrustPrice extends BaseEntity
 
     @TableField(exist = false)
     protected Long tenantId;
+
+
+
 }

+ 5 - 3
src/main/java/cn/ezhizao/project/system/controller/SysUserController.java

@@ -92,8 +92,10 @@ public class SysUserController extends BaseController
     {
         ExcelUtil<SysUser> util = new ExcelUtil<>(SysUser.class);
         List<SysUser> userList = util.importExcel(file.getInputStream());
+        SysUser user = new SysUser();
+        setTenantId(user);
         String operName = getUsername();
-        String message = userService.importUser(userList, updateSupport, operName);
+        String message = userService.importUser(userList, updateSupport, operName,user.getTenantId());
         return success(message);
     }
 
@@ -116,12 +118,12 @@ public class SysUserController extends BaseController
         if (StringUtils.isNotNull(userId))
         {
             SysUser sysUser = userService.selectUserById(userId);
-
+            setTenantId(sysUser);
             ajax.put(AjaxResult.DATA_TAG, sysUser);
             ajax.put("postIds", postService.selectPostListByUserId(userId));
             ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
             QueryWrapper<BizUserTenant> userTenantQueryWrapper = new QueryWrapper<>();
-            userTenantQueryWrapper.eq("user_id", sysUser.getUserId());
+            userTenantQueryWrapper.eq("user_id", sysUser.getUserId()).eq("tenant_id", sysUser.getTenantId());
             BizUserTenant tenant = userTenantService.getOne(userTenantQueryWrapper);
             ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin() && tenant.getTenantId().equals(r.getTenantId())).collect(Collectors.toList()));
             ajax.put("posts", postService.selectPostAll().stream().filter(p -> tenant.getTenantId().equals(p.getTenantId())).collect(Collectors.toList()));

+ 18 - 18
src/main/java/cn/ezhizao/project/system/domain/SysUser.java

@@ -29,7 +29,7 @@ public class SysUser extends BaseEntity
     private static final long serialVersionUID = 1L;
 
     /** 用户ID */
-    @Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号")
+//    @Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号")
     @TableId
     private Long userId;
 
@@ -44,28 +44,28 @@ public class SysUser extends BaseEntity
     /** 部门ID */
     private Long deptId;
 
-    @Excel(name = "部门名称", type = Type.IMPORT)
+    @Excel(name = "归属部门", type = Type.IMPORT,sort = 4)
     private String deptName;
 
 
     /** 用户账号 */
-    @Excel(name = "登录名称")
+    @Excel(name = "用户名称" ,sort = 1)
     private String userName;
 
     /** 用户昵称 */
-    @Excel(name = "用户名称")
+    @Excel(name = "用户昵称",sort = 2)
     private String nickName;
 
     /** 用户邮箱 */
-    @Excel(name = "用户邮箱")
+//    @Excel(name = "用户邮箱")
     private String email;
 
     /** 手机号码 */
-    @Excel(name = "手机号码")
+    @Excel(name = "手机号码",sort = 3)
     private String phonenumber;
 
     /** 用户性别 */
-    @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
+//    @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
     private String sex;
 
     /** 用户头像 */
@@ -162,47 +162,47 @@ public class SysUser extends BaseEntity
     }
 
     /** 性别 */
-    @Excel(name = "性别")
+//    @Excel(name = "性别")
     private String gender;
 
     /** 身份证号 */
-    @Excel(name = "身份证号")
+//    @Excel(name = "身份证号")
     private String cardNo;
 
     /** 照片 */
-    @Excel(name = "照片")
+//    @Excel(name = "照片")
     private String photo;
 
     /** 年龄 */
-    @Excel(name = "年龄")
+//    @Excel(name = "年龄")
     private Integer age;
 
     /** 生日 */
-    @Excel(name = "生日")
+//    @Excel(name = "生日")
     private String birthday;
 
     /** 电话号 */
-    @Excel(name = "电话号")
+//    @Excel(name = "电话号")
     private String phone;
 
     /** 微信号 */
-    @Excel(name = "微信号")
+//    @Excel(name = "微信号")
     private String wechatNo;
 
     /** 入职时间 */
-    @Excel(name = "入职时间")
+//    @Excel(name = "入职时间")
     private String entryTime;
 
     /** 离职时间 */
-    @Excel(name = "离职时间")
+//    @Excel(name = "离职时间")
     private String resignationTime;
 
     /** 是否是兼职人员 */
-    @Excel(name = "是否是兼职人员")
+//    @Excel(name = "是否是兼职人员")
     private Integer isPartTimer;
 
     /** 帐号状态(0正常 1停用) */
-    @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
+//    @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
     private String status;
 
     /** 删除标志(0代表存在 2代表删除) */

+ 7 - 0
src/main/java/cn/ezhizao/project/system/mapper/SysDeptMapper.java

@@ -104,6 +104,11 @@ public interface SysDeptMapper
      */
     public int updateDept(SysDept dept);
 
+    /**
+     * 查询部门信息
+     */
+    SysDept getDept( SysDept dept);
+
     /**
      * 修改所在部门正常状态
      *
@@ -141,4 +146,6 @@ public interface SysDeptMapper
      * @return 结果
      */
     public int deleteDeptById(Long deptId);
+
+
 }

+ 1 - 1
src/main/java/cn/ezhizao/project/system/service/ISysUserService.java

@@ -213,7 +213,7 @@ public interface ISysUserService
      * @param operName 操作用户
      * @return 结果
      */
-    public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName);
+    public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName,Long tenantId);
 
     SysUser selectUserByPhoneNumber(String userName);
 

+ 61 - 10
src/main/java/cn/ezhizao/project/system/service/impl/SysUserServiceImpl.java

@@ -12,7 +12,9 @@ import cn.ezhizao.project.system.mapper.*;
 import cn.ezhizao.project.system.service.ISysConfigService;
 import cn.ezhizao.project.system.service.ISysUserService;
 import cn.ezhizao.project.tenant.domain.BizUserTenant;
+import cn.ezhizao.project.tenant.mapper.BizUserTenantMapper;
 import cn.ezhizao.project.tenant.service.IBizUserTenantService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
@@ -51,9 +53,15 @@ public class SysUserServiceImpl implements ISysUserService
     @Resource
     private SysUserPostMapper userPostMapper;
 
+    @Resource
+    private BizUserTenantMapper bizUserTenantMapper;
+
     @Resource
     private ISysConfigService configService;
 
+    @Resource
+    private   SysDeptMapper deptMapper;
+
     @Resource
     protected Validator validator;
 
@@ -291,6 +299,32 @@ public class SysUserServiceImpl implements ISysUserService
     {
         // 新增用户信息
         int rows = userMapper.insertUser(user);
+
+        // 新增用户岗位关联
+        insertUserPost(user);
+        // 新增用户与角色管理
+        insertUserRole(user);
+        return rows;
+    }
+
+    /**
+     * 新增保存用户信息
+     *
+     * @param user 用户信息
+     * @return 结果
+     */
+    @Transactional
+    public int insertUserImport(SysUser user)
+    {
+        // 新增用户信息
+        int rows = userMapper.insertUser(user);
+
+        BizUserTenant bizUserTenant = new BizUserTenant();
+        bizUserTenant.setUserId(user.getUserId());
+        bizUserTenant.setTenantId(user.getTenantId());
+        bizUserTenant.setDeptId(user.getDeptId());
+        bizUserTenantMapper.insert(bizUserTenant);
+
         // 新增用户岗位关联
         insertUserPost(user);
         // 新增用户与角色管理
@@ -298,6 +332,8 @@ public class SysUserServiceImpl implements ISysUserService
         return rows;
     }
 
+
+
     /**
      * 注册用户信息
      *
@@ -330,7 +366,7 @@ public class SysUserServiceImpl implements ISysUserService
         // 新增用户与岗位管理
         insertUserPost(user);
         // 更新tenantId的部门
-        BizUserTenant userTenant = userTenantService.query().eq("user_id",user.getUserId()).one();
+        BizUserTenant userTenant = userTenantService.query().eq("user_id",user.getUserId()).eq("tenant_id",user.getTenantId()).one();
         if(userTenant!=null){
             userTenant.setDeptId(user.getDeptId());
             userTenantService.updateById(userTenant);
@@ -518,7 +554,7 @@ public class SysUserServiceImpl implements ISysUserService
      * @return 结果
      */
     @Override
-    public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName)
+    public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName,Long tenantId)
     {
         if (StringUtils.isNull(userList) || userList.size() == 0)
         {
@@ -537,14 +573,29 @@ public class SysUserServiceImpl implements ISysUserService
                 SysUser u = userMapper.selectUserByUserName(user.getUserName());
                 if (StringUtils.isNull(u))
                 {
-                    BeanValidators.validateWithException(validator, user);
-                    checkUserAllowed(user);
-                    checkUserDataScope(user.getUserId());
-                    user.setPassword(SecurityUtils.encryptPassword(password));
-                    user.setCreateBy(operName);
-                    this.insertUser(user);
-                    successNum++;
-                    successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功");
+
+                    SysDept dept = new SysDept();
+                    dept.setTenantId(tenantId);
+                    dept.setDeptName(user.getDeptName());
+                    dept=deptMapper.getDept(dept);
+
+                    if(dept!=null){
+                        BeanValidators.validateWithException(validator, user);
+                        checkUserAllowed(user);
+                        checkUserDataScope(user.getUserId());
+                        user.setPassword(SecurityUtils.encryptPassword(password));
+                        user.setCreateBy(operName);
+                        user.setTenantId(tenantId);
+                        user.setDeptId(dept.getDeptId());
+
+                        this.insertUserImport(user);
+                        successNum++;
+                        successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功");
+                    }else{
+                        failureNum++;
+                        failureMsg .append("<br/>" + failureNum + "、账号 " + user.getDeptName() + " 部门不存在");
+                    }
+
                 }
                 else if (isUpdateSupport)
                 {

+ 10 - 0
src/main/resources/mybatis/system/SysDeptMapper.xml

@@ -31,6 +31,16 @@
 		from sys_dept d
 	</sql>
 
+	<select id="getDept" parameterType="SysDept" resultMap="SysDeptResult">
+		SELECT * FROM sys_dept
+		<trim prefix=" WHERE" suffix="" suffixOverrides="AND">
+			del_flag = '0'
+			<if test="id != null "> AND id = #{id}</if>
+			<if test="deptName != null "> AND dept_name = #{deptName}</if>
+			<if test="tenantId != null "> AND tenant_id = #{tenantId}</if>
+		</trim>
+	</select>
+
 	<select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
 		<include refid="selectDeptVo"/>
 		where d.del_flag = '0'