Переглянути джерело

管乐迷管理端维修技师

zouxuan 3 роки тому
батько
коміт
ae9c008ef9

+ 73 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/AccountLogQueryInfo.java

@@ -0,0 +1,73 @@
+package com.ym.mec.biz.dal.page;
+
+import com.ym.mec.common.page.QueryInfo;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.Date;
+
+/**
+* @author zx
+* @date 2021/9/26 15:52
+*/
+public class AccountLogQueryInfo extends QueryInfo {
+
+    private String organId;
+
+    private String groupType;
+
+    private Date payStartTime;
+
+    private Date payEndTime;
+
+    private Date createStartTime;
+
+    private Date createEndTime;
+
+    public String getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(String organId) {
+        this.organId = organId;
+    }
+
+    public String getGroupType() {
+        return groupType;
+    }
+
+    public void setGroupType(String groupType) {
+        this.groupType = groupType;
+    }
+
+    public Date getPayStartTime() {
+        return payStartTime;
+    }
+
+    public void setPayStartTime(Date payStartTime) {
+        this.payStartTime = payStartTime;
+    }
+
+    public Date getPayEndTime() {
+        return payEndTime;
+    }
+
+    public void setPayEndTime(Date payEndTime) {
+        this.payEndTime = payEndTime;
+    }
+
+    public Date getCreateStartTime() {
+        return createStartTime;
+    }
+
+    public void setCreateStartTime(Date createStartTime) {
+        this.createStartTime = createStartTime;
+    }
+
+    public Date getCreateEndTime() {
+        return createEndTime;
+    }
+
+    public void setCreateEndTime(Date createEndTime) {
+        this.createEndTime = createEndTime;
+    }
+}

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/MusicGroupQueryInfo.java

@@ -50,6 +50,17 @@ public class MusicGroupQueryInfo extends QueryInfo {
     
     
     private Date billEndDate;
     private Date billEndDate;
 
 
+    @ApiModelProperty(value = "维修技师")
+    private Integer repairUserId;
+
+    public Integer getRepairUserId() {
+        return repairUserId;
+    }
+
+    public void setRepairUserId(Integer repairUserId) {
+        this.repairUserId = repairUserId;
+    }
+
     public Integer getCooperationOrganId() {
     public Integer getCooperationOrganId() {
         return cooperationOrganId;
         return cooperationOrganId;
     }
     }

+ 0 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/SysUserCashAccountLogService.java

@@ -7,5 +7,4 @@ import com.ym.mec.common.service.BaseService;
 
 
 public interface SysUserCashAccountLogService extends BaseService<Long, SysUserCashAccountLog> {
 public interface SysUserCashAccountLogService extends BaseService<Long, SysUserCashAccountLog> {
 
 
-    PageInfo<SysUserCashAccountLog> queryLogPage(QueryInfo queryInfo);
 }
 }

+ 0 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysUserCashAccountLogServiceImpl.java

@@ -21,9 +21,4 @@ public class SysUserCashAccountLogServiceImpl extends BaseServiceImpl<Long, SysU
 		return sysUserCashAccountLogDao;
 		return sysUserCashAccountLogDao;
 	}
 	}
 
 
-    @Override
-    public PageInfo<SysUserCashAccountLog> queryLogPage(QueryInfo queryInfo) {
-		queryPage(queryInfo);
-        return null;
-    }
 }
 }

+ 28 - 20
mec-biz/src/main/resources/config/mybatis/SysUserCashAccountLogMapper.xml

@@ -49,14 +49,8 @@
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.SysUserCashAccountLog">
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.SysUserCashAccountLog">
         UPDATE sys_user_cash_account_log
         UPDATE sys_user_cash_account_log
         <set>
         <set>
-            <if test="userId != null">user_id_ = #{userId},</if>
-            <if test="organId != null">organ_id_ = #{organId},</if>
-            <if test="groupId != null">group_id_ = #{groupId},</if>
             <if test="comment != null">comment_ = #{comment},</if>
             <if test="comment != null">comment_ = #{comment},</if>
-            <if test="amount != null">amount_ = #{amount},</if>
-            <if test="groupType != null">group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},</if>
             <if test="transNo != null">trans_no_ = #{transNo},</if>
             <if test="transNo != null">trans_no_ = #{transNo},</if>
-            <if test="returnFeeType != null">return_fee_type_ = #{returnFeeType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},</if>
             <if test="payTime != null">pay_time_ = #{payTime},</if>
             <if test="payTime != null">pay_time_ = #{payTime},</if>
             update_time_ = NOW()
             update_time_ = NOW()
         </set>
         </set>
@@ -70,30 +64,44 @@
 
 
     <!-- 分页查询 -->
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="SysUserCashAccountLog" parameterType="map">
     <select id="queryPage" resultMap="SysUserCashAccountLog" parameterType="map">
-        SELECT * FROM sys_user_cash_account_log
-        <where>
-            <if test="userId != null">
-                user_id_ = #{userId}
-            </if>
-            <if test="search != null and search != ''">
-                AND create_time_ LIKE CONCAT(#{search},'%')
-            </if>
-        </where>
+        SELECT cal.*,su.username_,o.name_ organ_name_ FROM sys_user_cash_account_log cal
+        LEFT JOIN sys_user su ON su.id_ = cal.user_id_
+        LEFT JOIN organization o ON o.id_ = cal.organ_id_
+        <include refid="queryPageSql"/>
         ORDER BY id_ DESC
         ORDER BY id_ DESC
         <include refid="global.limit"/>
         <include refid="global.limit"/>
     </select>
     </select>
 
 
     <!-- 查询当前表的总记录数 -->
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
     <select id="queryCount" resultType="int">
-        SELECT COUNT(*) FROM sys_user_cash_account_log
+        SELECT COUNT(cal.id_) FROM sys_user_cash_account_log cal
+        LEFT JOIN sys_user su ON su.id_ = cal.user_id_
+        <include refid="queryPageSql"/>
+    </select>
+    <sql id="queryPageSql">
         <where>
         <where>
-            <if test="userId != null">
-                user_id_ = #{userId}
+            <if test="createStartTime != null">
+                AND cal.create_time_ >= #{createStartTime}
+            </if>
+            <if test="createEndTime != null">
+                AND cal.create_time_ &lt;= #{createStartTime}
+            </if>
+            <if test="payStartTime != null">
+                AND cal.pay_time_ >= #{payStartTime}
+            </if>
+            <if test="payEndTime != null">
+                AND cal.pay_time_ &lt;= #{payStartTime}
+            </if>
+            <if test="groupType != null and groupType != ''">
+                AND cal.group_type_ = #{groupType}
+            </if>
+            <if test="organId != null and organId != ''">
+                AND FIND_IN_SET(cal.organ_id_,#{organId})
             </if>
             </if>
             <if test="search != null and search != ''">
             <if test="search != null and search != ''">
-                AND create_time_ LIKE CONCAT(#{search},'%')
+                AND (cal.user_id_ = #{search} OR cal.group_id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%') OR cal.trans_no_ LIKE CONCAT('%',#{search},'%'))
             </if>
             </if>
         </where>
         </where>
-    </select>
+    </sql>
 
 
 </mapper>
 </mapper>

+ 53 - 0
mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java

@@ -145,6 +145,59 @@ public class ExportController extends BaseController {
     private MusicEnlightenmentQuestionnaireService musicEnlightenmentQuestionnaireService;
     private MusicEnlightenmentQuestionnaireService musicEnlightenmentQuestionnaireService;
     @Autowired
     @Autowired
     private MusicGroupService musicGroupService;
     private MusicGroupService musicGroupService;
+    @Autowired
+    private SysUserCashAccountLogService sysUserCashAccountLogService;
+
+    @ApiOperation(value = "退费记录导出")
+    @RequestMapping("export/userCashAccountLog")
+    @PreAuthorize("@pcs.hasPermissions('export/userCashAccountLog')")
+    public void exportUserCashAccountLog(HttpServletResponse response, AccountLogQueryInfo queryInfo) throws IOException {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            throw new BizException("用户信息获取失败");
+        }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+            queryInfo.setOrganId(employee.getOrganIdList());
+        }else if(StringUtils.isEmpty(employee.getOrganIdList())){
+            throw new BizException("用户所在分部异常");
+        }else {
+            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+            if(!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))){
+                throw new BizException("非法请求");
+            }
+        }
+        queryInfo.setPage(1);
+        queryInfo.setRows(49999);
+        List<SysUserCashAccountLog> rows = sysUserCashAccountLogService.queryPage(queryInfo).getRows();
+        if(rows.size() < 1){
+            throw new BizException("没有可导出数据");
+        }
+        OutputStream outputStream = response.getOutputStream();
+        try {
+            HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"退费编号", "学员编号", "学员姓名","分部", "课程组编号", "课程组类型",
+                    "退费金额","退费类型","退费时间","交易流水号", "打款时间"}, new String[]{
+                    "id", "userId","username", "organName", "groupId","groupType.desc",
+                    "amount", "returnFeeType.msg", "createTime", "transNo","payTime"}, rows);
+            response.setContentType("application/octet-stream");
+            response.setHeader("Content-Disposition", "attac:wq" +
+                    "hment;filename=classGroup-" + DateUtil.getDate(new Date()) + ".xls");
+            response.flushBuffer();
+            outputStream = response.getOutputStream();
+            workbook.write(outputStream);
+            outputStream.flush();
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (outputStream != null) {
+                try {
+                    outputStream.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
 
 
     @ApiOperation(value = "乐团列表导出")
     @ApiOperation(value = "乐团列表导出")
     @PostMapping("export/musicGroup")
     @PostMapping("export/musicGroup")

+ 33 - 8
mec-web/src/main/java/com/ym/mec/web/controller/SysUserCashAccountLogController.java

@@ -2,22 +2,23 @@ package com.ym.mec.web.controller;
 
 
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.EmployeeDao;
+import com.ym.mec.biz.dal.entity.Employee;
+import com.ym.mec.biz.dal.entity.SysUserCashAccountLog;
+import com.ym.mec.biz.dal.page.AccountLogQueryInfo;
 import com.ym.mec.biz.service.SysUserCashAccountLogService;
 import com.ym.mec.biz.service.SysUserCashAccountLogService;
-import com.ym.mec.biz.service.SysUserCashAccountService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.controller.BaseController;
-import com.ym.mec.common.page.QueryInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
-import java.math.BigDecimal;
-
-import static com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum.FILL_ACCOUNT;
+import java.util.Arrays;
+import java.util.List;
 
 
 @RequestMapping("userCashAccountLog")
 @RequestMapping("userCashAccountLog")
 @Api(tags = "用户账户退费记录")
 @Api(tags = "用户账户退费记录")
@@ -28,6 +29,8 @@ public class SysUserCashAccountLogController extends BaseController {
 	private SysUserCashAccountLogService sysUserCashAccountLogService;
 	private SysUserCashAccountLogService sysUserCashAccountLogService;
 	@Autowired
 	@Autowired
 	private SysUserFeignService sysUserFeignService;
 	private SysUserFeignService sysUserFeignService;
+	@Autowired
+	private EmployeeDao employeeDao;
 
 
 	@ApiOperation(value = "获取退费详情")
 	@ApiOperation(value = "获取退费详情")
 	@GetMapping("/get")
 	@GetMapping("/get")
@@ -40,10 +43,32 @@ public class SysUserCashAccountLogController extends BaseController {
 		return succeed(sysUserCashAccountLogService.get(id));
 		return succeed(sysUserCashAccountLogService.get(id));
 	}
 	}
 
 
+	@ApiOperation(value = "修改")
+	@GetMapping("/update")
+	@PreAuthorize("@pcs.hasPermissions('userCashAccountLog/update')")
+	public Object update(SysUserCashAccountLog sysUserCashAccountLog) {
+		return succeed(sysUserCashAccountLogService.update(sysUserCashAccountLog));
+	}
+
 	@ApiOperation(value = "分页查询收费类型列表")
 	@ApiOperation(value = "分页查询收费类型列表")
 	@GetMapping("/queryPage")
 	@GetMapping("/queryPage")
 	@PreAuthorize("@pcs.hasPermissions('userCashAccountLog/queryPage')")
 	@PreAuthorize("@pcs.hasPermissions('userCashAccountLog/queryPage')")
-	public Object queryPage(QueryInfo queryInfo) {
-		return succeed(sysUserCashAccountLogService.queryLogPage(queryInfo));
+	public Object queryPage(AccountLogQueryInfo queryInfo) {
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		if (sysUser == null) {
+			return failed("用户信息获取失败");
+		}
+		Employee employee = employeeDao.get(sysUser.getId());
+		if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+			queryInfo.setOrganId(employee.getOrganIdList());
+		}else if(StringUtils.isEmpty(employee.getOrganIdList())){
+			return failed("用户所在分部异常");
+		}else {
+			List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+			if(!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))){
+				return failed("非法请求");
+			}
+		}
+		return succeed(sysUserCashAccountLogService.queryPage(queryInfo));
 	}
 	}
 }
 }