Merge branch 'master' of http://118.89.139.230:10101/r/powerIntelligenceSystem
| | |
| | | return service.add(spare,file); |
| | | } |
| | | |
| | | @PostMapping("addByExcel") |
| | | @ApiOperation("excel导入") |
| | | public Response addByExcel(@RequestParam MultipartFile file) throws IOException { |
| | | return service.addByExcel(file); |
| | | } |
| | | |
| | | |
| | | @PostMapping("update") |
| | | @ApiOperation("修改") |
| | | public Response update(@RequestBody DeviceSpare spare) { |
| | |
| | | import com.whyc.service.WorkflowLinkService; |
| | | import com.whyc.service.WorkflowMainService; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.CommonUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @GetMapping("ownStatistics") |
| | | @ApiOperation(value = "本人的单据统计",notes = "status含义:1-审批中,2-审批完成且通过,3-审批完成且驳回") |
| | | public Response<Map<Integer,Integer>> getOwnStatistics(int type){ |
| | | int userId = ActionUtil.getUser().getId().intValue(); |
| | | int userId = CommonUtil.getUser().getId().intValue(); |
| | | return service.getOwnStatistics(userId,type); |
| | | } |
| | | |
| | |
| | | @GetMapping("ownListPage") |
| | | @ApiOperation(value = "本人的单据列表分页",notes = "status传参:0:全部,1-审批中,2-审批完成且通过,3-审批完成且驳回") |
| | | public Response<PageInfo<WorkflowMain>> ownListPage(int type,int status,int pageNum,int pageSize){ |
| | | int userId = ActionUtil.getUser().getId().intValue(); |
| | | int userId = CommonUtil.getUser().getId().intValue(); |
| | | return service.ownListPage(userId,type,status,pageNum,pageSize); |
| | | } |
| | | |
| | |
| | | @GetMapping("receivedStatistics") |
| | | @ApiOperation(value = "接收到的单据统计",notes = "status含义:1-待接单,6-待审核,58-已审核") |
| | | public Response<Map<Integer,Integer>> getReceivedStatistics(int type){ |
| | | User user = ActionUtil.getUser(); |
| | | User user = CommonUtil.getUser(); |
| | | return service.getReceivedStatistics(type,user); |
| | | } |
| | | |
| | |
| | | @GetMapping("receivedListPage") |
| | | @ApiOperation(value = "接收到的单据列表分页", notes = "status传参:0-全部,1-待接单,6-待审核,5|8-已审核(通过|驳回)") |
| | | public Response<PageInfo<WorkflowMain>> getReceivedListPage(int type, int status, int pageNum, int pageSize) { |
| | | User user = ActionUtil.getUser(); |
| | | User user = CommonUtil.getUser(); |
| | | return service.getReceivedListPage(type, status, user, pageNum, pageSize); |
| | | } |
| | | |
| | |
| | | |
| | | import com.whyc.pojo.web_site.DeviceSpare; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface DeviceSpareMapper extends CustomMapper<DeviceSpare>{ |
| | | |
| | | void outBound(List<DeviceSpare> spareList); |
| | | |
| | | } |
| | |
| | | import com.whyc.util.CommonUtil; |
| | | import com.whyc.util.ThreadLocalUtil; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.apache.poi.ss.usermodel.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | return new Response<List<DeviceSpare>>().set(1,deviceSpares); |
| | | } |
| | | |
| | | public void add(List<DeviceSpare> spareList) { |
| | | public void addBatch(List<DeviceSpare> spareList) { |
| | | mapper.insertBatchSomeColumn(spareList); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | public void outBound(List<DeviceSpare> spareList) { |
| | | mapper.outBound(spareList); |
| | | } |
| | | |
| | | public Response addByExcel(MultipartFile file) throws IOException { |
| | | //将文件流转化为workbook |
| | | Workbook book = WorkbookFactory.create(file.getInputStream()); |
| | | Sheet sheet = book.getSheetAt(0); |
| | | //获取最后一行 |
| | | int lastRowIndex = sheet.getLastRowNum(); |
| | | List<DeviceSpare> spareList = new ArrayList<>(); |
| | | for (int i = 1; i <= lastRowIndex; i++) { |
| | | DeviceSpare spare = new DeviceSpare(); |
| | | Row row = sheet.getRow(i); |
| | | //对每行的前7列进行非空校验 |
| | | for (int j = 0; j < 7; j++) { |
| | | Cell cell = row.getCell(j); |
| | | //非图片列进行非空校验.不合规无法上传 |
| | | if (cell == null || cell.getCellType() == CellType.BLANK) { |
| | | return new Response().set(1, false, "第" + (i + 1) + "行第" + (j + 1) + "列数据为空"); |
| | | } |
| | | } |
| | | //获取列的值 |
| | | String name = row.getCell(0).getStringCellValue(); |
| | | String model = row.getCell(1).getStringCellValue(); |
| | | String version = row.getCell(2).getStringCellValue(); |
| | | int quantity = (int) row.getCell(3).getNumericCellValue(); |
| | | String brand = row.getCell(4).getStringCellValue(); |
| | | String type = row.getCell(5).getStringCellValue(); |
| | | String supplier = row.getCell(6).getStringCellValue(); |
| | | spare.setName(name); |
| | | spare.setModel(model); |
| | | spare.setVersion(version); |
| | | spare.setQuantity(quantity); |
| | | spare.setBrand(brand); |
| | | spare.setType(type); |
| | | spare.setSupplier(supplier); |
| | | |
| | | spareList.add(spare); |
| | | //第七列为图片 TODO 待处理 |
| | | /*Cell cell = row.getCell(7); |
| | | CellType cellType = cell.getCellType(); |
| | | System.out.println("-");*/ |
| | | } |
| | | addBatch(spareList); |
| | | |
| | | return null; |
| | | } |
| | | } |
| | |
| | | link.setDealAndClose(1); |
| | | } |
| | | }break; |
| | | //设备入库申请 TODO 入库影响库存 |
| | | //设备入库申请 |
| | | case 2: |
| | | //设备报废申请 |
| | | case 3:{ |
| | |
| | | link.setDealAndClose(1); |
| | | } |
| | | }break; |
| | | case 4:{ //TODO 出库申请 |
| | | case 4:{ // 出库申请 |
| | | if(link.getStatus() == WorkflowEnum.LINK_STATUS_PASS.getValue().intValue()){ |
| | | mainInDB.setStatus(WorkflowEnum.MAIN_STATUS_WAIT_FOR_DEALING.getValue()); |
| | | mainInDB.setStatus(WorkflowEnum.MAIN_STATUS_END_PASS.getValue()); |
| | | mainInDB.setEndTime(now); |
| | | mainInDB.setEndReason(link.getDealReason()); |
| | | mainService.updateById(mainInDB); |
| | | //获取出库申请单设备 |
| | | List<WorkflowDevice> deviceListInDB = deviceService.getByMainId(mainInDB.getId()); |
| | | List<DeviceSpare> spareList = new ArrayList<>(); |
| | | deviceListInDB.forEach(device -> { |
| | | DeviceSpare spare = new DeviceSpare(); |
| | | BeanUtils.copyProperties(device,spare); |
| | | spareList.add(spare); |
| | | }); |
| | | //更新库存 |
| | | deviceSpareService.outBound(spareList); |
| | | }else if(link.getStatus() == WorkflowEnum.LINK_STATUS_REJECT.getValue().intValue()){ |
| | | mainInDB.setStatus(WorkflowEnum.MAIN_STATUS_END_REJECT.getValue()); |
| | | mainInDB.setEndReason(link.getDealRejectReason()); |
| | | mainInDB.setEndTime(now); |
| | | //检查是否有关联工单.如果有关联工单,关联工单状态重置为完结待处理,完成时间重置为空 |
| | | if(mainInDB.getRelatedId() != null){ |
| | | Integer relatedId = mainInDB.getRelatedId(); |
| | | //mainService.resetRepairStatus(relatedId,mainInDB.getQuantity()); |
| | | } |
| | | mainService.updateById(mainInDB); |
| | | link.setDealAndClose(1); |
| | | } |
New file |
| | |
| | | <?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.whyc.mapper.DeviceSpareMapper" > |
| | | |
| | | <update id="outBound"> |
| | | <foreach collection="list" item="item" separator=";"> |
| | | update web_site.tb_device_spare set quantity = quantity - #{item.quantity} |
| | | where name = #{item.name} |
| | | and model = #{item.model} |
| | | and version = #{item.version} |
| | | and brand = #{item.brand} |
| | | and type = #{item.type} |
| | | and supplier = #{item.supplier} |
| | | </foreach> |
| | | </update> |
| | | </mapper> |
| | |
| | | l.id link_id, |
| | | l.main_id, |
| | | l.parent_id, |
| | | l.process_level as lProcessLevel, |
| | | l.process_level_name, |
| | | l.process_stage, |
| | | l.process_name, |
| | | l.create_time link_create_time, |
| | | l.deal_user_id, |
| | | l.deal_type, |
| | |
| | | <id column="link_id" property="id"/> |
| | | <result column="main_id" property="mainId"/> |
| | | <result column="parent_id" property="parentId"/> |
| | | <result column="lProcessLevel" property="processLevel"/> |
| | | <result column="process_level_name" property="processLevelName"/> |
| | | <result column="process_stage" property="processStage"/> |
| | | <result column="process_name" property="processName"/> |
| | | <result column="link_create_time" property="createTime"/> |
| | | <result column="deal_user_id" property="dealUserId"/> |
| | | <result column="deal_type" property="dealType"/> |
| | |
| | | <choose> |
| | | <!--全部--> |
| | | <when test="status==0"> |
| | | SELECT m.*,u.uName as create_user_name,<include refid="linkColumn" /> |
| | | FROM web_site.tb_workflow_main m,web_site.tb_workflow_link l,db_user.tb_user_inf u |
| | | SELECT m.*,u.name as create_user_name,<include refid="linkColumn" /> |
| | | FROM web_site.tb_workflow_main m,web_site.tb_workflow_link l,db_user.tb_user u |
| | | where m.id = l.main_id |
| | | and m.create_user_id = u.uId |
| | | and m.create_user_id = u.id |
| | | and m.type = #{type} |
| | | and l.deal_role_id = #{user.uRole} |
| | | and l.deal_role_id = #{user.role} |
| | | and l.deal_user_id is null |
| | | union all |
| | | SELECT m.*,u.uName as create_user_name,<include refid="linkColumn" /> |
| | | FROM web_site.tb_workflow_main m,web_site.tb_workflow_link l,db_user.tb_user_inf u |
| | | SELECT m.*,u.name as create_user_name,<include refid="linkColumn" /> |
| | | FROM web_site.tb_workflow_main m,web_site.tb_workflow_link l,db_user.tb_user u |
| | | where m.id = l.main_id |
| | | and m.create_user_id = u.uId |
| | | and m.create_user_id = u.id |
| | | and m.type = #{type} |
| | | and l.deal_user_id = #{user.uId} order by id desc |
| | | and l.deal_user_id = #{user.id} order by id desc |
| | | </when> |
| | | <!--待接单--> |
| | | <when test="status==1"> |
| | | SELECT m.*,u.uName as create_user_name,<include refid="linkColumn" /> |
| | | FROM web_site.tb_workflow_main m,web_site.tb_workflow_link l,db_user.tb_user_inf u |
| | | SELECT m.*,u.name as create_user_name,<include refid="linkColumn" /> |
| | | FROM web_site.tb_workflow_main m,web_site.tb_workflow_link l,db_user.tb_user u |
| | | where m.id = l.main_id |
| | | and m.create_user_id = u.uId |
| | | and m.create_user_id = u.id |
| | | and m.type = #{type} |
| | | and l.deal_role_id = #{user.uRole} |
| | | and l.deal_role_id = #{user.role} |
| | | and l.deal_user_id is null |
| | | and l.status = #{status} order by m.id desc |
| | | </when> |
| | | <otherwise> |
| | | SELECT m.*,u.uName as create_user_name,<include refid="linkColumn" /> |
| | | FROM web_site.tb_workflow_main m,web_site.tb_workflow_link l,db_user.tb_user_inf u |
| | | SELECT m.*,u.name as create_user_name,<include refid="linkColumn" /> |
| | | FROM web_site.tb_workflow_main m,web_site.tb_workflow_link l,db_user.tb_user u |
| | | where m.id = l.main_id |
| | | and m.create_user_id = u.uId |
| | | and m.create_user_id = u.id |
| | | and m.type = #{type} |
| | | and l.deal_user_id = #{user.uId} |
| | | and l.deal_user_id = #{user.id} |
| | | and l.status = #{status} order by m.id desc |
| | | </otherwise> |
| | | </choose> |