|
@@ -45,8 +45,7 @@ import javax.annotation.Resource;
|
|
*/
|
|
*/
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/ehs/jobticket")
|
|
@RequestMapping("/ehs/jobticket")
|
|
-public class TJobticketController extends BaseController
|
|
|
|
-{
|
|
|
|
|
|
+public class TJobticketController extends BaseController {
|
|
@Autowired
|
|
@Autowired
|
|
private ITJobticketService tJobticketService;
|
|
private ITJobticketService tJobticketService;
|
|
|
|
|
|
@@ -58,18 +57,18 @@ public class TJobticketController extends BaseController
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
private TJobticketMapper tJobticketMapper;
|
|
private TJobticketMapper tJobticketMapper;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 查询工作票列表
|
|
* 查询工作票列表
|
|
*/
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('ehs:jobticket:list')")
|
|
@PreAuthorize("@ss.hasPermi('ehs:jobticket:list')")
|
|
@GetMapping("/list")
|
|
@GetMapping("/list")
|
|
- public TableDataInfo list(TJobticket tJobticket)
|
|
|
|
- {
|
|
|
|
|
|
+ public TableDataInfo list(TJobticket tJobticket) {
|
|
startPage();
|
|
startPage();
|
|
List<TJobticket> list = tJobticketService.selectTJobticketList(tJobticket);
|
|
List<TJobticket> list = tJobticketService.selectTJobticketList(tJobticket);
|
|
//查询续票
|
|
//查询续票
|
|
- for (TJobticket t: list
|
|
|
|
- ) {
|
|
|
|
|
|
+ for (TJobticket t : list
|
|
|
|
+ ) {
|
|
List<TJobticket> cList = tJobticketMapper.selectTJobticketChildren(t);
|
|
List<TJobticket> cList = tJobticketMapper.selectTJobticketChildren(t);
|
|
t.setChildren(cList);
|
|
t.setChildren(cList);
|
|
}
|
|
}
|
|
@@ -78,20 +77,19 @@ public class TJobticketController extends BaseController
|
|
|
|
|
|
//情况统计
|
|
//情况统计
|
|
@GetMapping("/fireData")
|
|
@GetMapping("/fireData")
|
|
- public List<DataEntity> fireData(Map param)
|
|
|
|
- {
|
|
|
|
- param.put("params" , new HashMap<>());
|
|
|
|
|
|
+ public List<DataEntity> fireData(Map param) {
|
|
|
|
+ param.put("params", new HashMap<>());
|
|
List<DataEntity> list = tJobticketMapper.selectFireData(param);
|
|
List<DataEntity> list = tJobticketMapper.selectFireData(param);
|
|
List<SysDictData> dictList = iSysDictTypeService.selectDictDataByType("HPJB");
|
|
List<SysDictData> dictList = iSysDictTypeService.selectDictDataByType("HPJB");
|
|
- for (DataEntity d: list
|
|
|
|
|
|
+ for (DataEntity d : list
|
|
) {
|
|
) {
|
|
- for (SysDictData s: dictList
|
|
|
|
|
|
+ for (SysDictData s : dictList
|
|
) {
|
|
) {
|
|
- if (StringUtils.isBlank(d.getDataName())){
|
|
|
|
|
|
+ if (StringUtils.isBlank(d.getDataName())) {
|
|
d.setDataName("未知");
|
|
d.setDataName("未知");
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- if (s.getDictValue().equals(d.getDataName())){
|
|
|
|
|
|
+ if (s.getDictValue().equals(d.getDataName())) {
|
|
d.setDataName(s.getDictLabel());
|
|
d.setDataName(s.getDictLabel());
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -106,12 +104,11 @@ public class TJobticketController extends BaseController
|
|
@PreAuthorize("@ss.hasPermi('ehs:jobticket:export')")
|
|
@PreAuthorize("@ss.hasPermi('ehs:jobticket:export')")
|
|
@Log(title = "工作票", businessType = BusinessType.EXPORT)
|
|
@Log(title = "工作票", businessType = BusinessType.EXPORT)
|
|
@GetMapping("/export")
|
|
@GetMapping("/export")
|
|
- public AjaxResult export(TJobticket tJobticket)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult export(TJobticket tJobticket) {
|
|
List<TJobticket> list = tJobticketService.selectTJobticketList(tJobticket);
|
|
List<TJobticket> list = tJobticketService.selectTJobticketList(tJobticket);
|
|
List<TJobticket> exportList = new ArrayList<>();
|
|
List<TJobticket> exportList = new ArrayList<>();
|
|
//查询续票
|
|
//查询续票
|
|
- for (TJobticket t: list
|
|
|
|
|
|
+ for (TJobticket t : list
|
|
) {
|
|
) {
|
|
exportList.add(t);
|
|
exportList.add(t);
|
|
List<TJobticket> cList = tJobticketMapper.selectTJobticketChildren(t);
|
|
List<TJobticket> cList = tJobticketMapper.selectTJobticketChildren(t);
|
|
@@ -128,8 +125,7 @@ public class TJobticketController extends BaseController
|
|
*/
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('ehs:jobticket:query')")
|
|
@PreAuthorize("@ss.hasPermi('ehs:jobticket:query')")
|
|
@GetMapping(value = "/{id}")
|
|
@GetMapping(value = "/{id}")
|
|
- public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult getInfo(@PathVariable("id") Long id) {
|
|
return AjaxResult.success(tJobticketService.selectTJobticketById(id));
|
|
return AjaxResult.success(tJobticketService.selectTJobticketById(id));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -139,13 +135,12 @@ public class TJobticketController extends BaseController
|
|
@PreAuthorize("@ss.hasPermi('ehs:jobticket:add')")
|
|
@PreAuthorize("@ss.hasPermi('ehs:jobticket:add')")
|
|
@Log(title = "工作票", businessType = BusinessType.INSERT)
|
|
@Log(title = "工作票", businessType = BusinessType.INSERT)
|
|
@PostMapping
|
|
@PostMapping
|
|
- public AjaxResult add(@RequestBody TJobticket tJobticket)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult add(@RequestBody TJobticket tJobticket) {
|
|
ISysUserService sysUserService = (ISysUserService) SpringContextUtils.getBean("sysUserService");
|
|
ISysUserService sysUserService = (ISysUserService) SpringContextUtils.getBean("sysUserService");
|
|
- StringBuilder contentUserUnit=new StringBuilder();
|
|
|
|
|
|
+ StringBuilder contentUserUnit = new StringBuilder();
|
|
List<SysDictData> book_user_unit = iSysDictTypeService.selectDictDataByType("book_user_unit");
|
|
List<SysDictData> book_user_unit = iSysDictTypeService.selectDictDataByType("book_user_unit");
|
|
|
|
|
|
- if(tJobticket.getUserUnit()!=null){
|
|
|
|
|
|
+ if (tJobticket.getUserUnit() != null) {
|
|
for (SysDictData p : book_user_unit) {
|
|
for (SysDictData p : book_user_unit) {
|
|
if (tJobticket.getUserUnit().toString().equals(p.getDictValue())) {
|
|
if (tJobticket.getUserUnit().toString().equals(p.getDictValue())) {
|
|
contentUserUnit.append(p.getDictLabel());//用户单位
|
|
contentUserUnit.append(p.getDictLabel());//用户单位
|
|
@@ -153,8 +148,8 @@ public class TJobticketController extends BaseController
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
- if(tJobticket.getUserMg()!=null){
|
|
|
|
- SysUser sysUser =sysUserService.selectUserById(tJobticket.getUserMg());
|
|
|
|
|
|
+ if (tJobticket.getUserMg() != null) {
|
|
|
|
+ SysUser sysUser = sysUserService.selectUserById(tJobticket.getUserMg());
|
|
contentUserUnit.append(sysUser.getNickName());
|
|
contentUserUnit.append(sysUser.getNickName());
|
|
|
|
|
|
}
|
|
}
|
|
@@ -170,32 +165,30 @@ public class TJobticketController extends BaseController
|
|
@PreAuthorize("@ss.hasPermi('ehs:jobticket:add')")
|
|
@PreAuthorize("@ss.hasPermi('ehs:jobticket:add')")
|
|
@Log(title = "工作票", businessType = BusinessType.INSERT)
|
|
@Log(title = "工作票", businessType = BusinessType.INSERT)
|
|
@RequestMapping("/batchAddJobticket")
|
|
@RequestMapping("/batchAddJobticket")
|
|
- public AjaxResult batchEdit(@RequestBody List<TInvoiceWorkcontent> dto)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult batchEdit(@RequestBody List<TInvoiceWorkcontent> dto) {
|
|
ISysUserService sysUserService = (ISysUserService) SpringContextUtils.getBean("sysUserService");
|
|
ISysUserService sysUserService = (ISysUserService) SpringContextUtils.getBean("sysUserService");
|
|
- StringBuilder contentUserUnit=new StringBuilder();
|
|
|
|
- int sameCount=0;
|
|
|
|
- int nosanmeCount=0;
|
|
|
|
|
|
+ StringBuilder contentUserUnit = new StringBuilder();
|
|
|
|
+ int sameCount = 0;
|
|
|
|
+ int nosanmeCount = 0;
|
|
List<SysDictData> book_user_unit = iSysDictTypeService.selectDictDataByType("book_user_unit");
|
|
List<SysDictData> book_user_unit = iSysDictTypeService.selectDictDataByType("book_user_unit");
|
|
//批量插入时 需要查询数据库是否有重复数据 若果有 就不新增
|
|
//批量插入时 需要查询数据库是否有重复数据 若果有 就不新增
|
|
for (int i = 0; i < dto.size(); i++) {
|
|
for (int i = 0; i < dto.size(); i++) {
|
|
- TJobticket tJobticket=new TJobticket();
|
|
|
|
- TInvoiceWorkcontent tInvoiceWorkcontent=dto.get(i);
|
|
|
|
|
|
+ TJobticket tJobticket = new TJobticket();
|
|
|
|
+ TInvoiceWorkcontent tInvoiceWorkcontent = dto.get(i);
|
|
//部门应该是导入票数据来源的承包商的所属部门
|
|
//部门应该是导入票数据来源的承包商的所属部门
|
|
tJobticket.setDeptId(tInvoiceWorkcontent.getBookingworkticket().getDeptId());
|
|
tJobticket.setDeptId(tInvoiceWorkcontent.getBookingworkticket().getDeptId());
|
|
- tJobticket.setContent(tInvoiceWorkcontent.getBookingworkticket().getWorkArea()+tInvoiceWorkcontent.getWorkDescription());
|
|
|
|
|
|
+ tJobticket.setContent(tInvoiceWorkcontent.getBookingworkticket().getWorkArea() + tInvoiceWorkcontent.getWorkDescription());
|
|
//byc 联系人 用户主管+用户单位
|
|
//byc 联系人 用户主管+用户单位
|
|
- if(tInvoiceWorkcontent.getBookingworkticket().getUserUnit()!=null){
|
|
|
|
|
|
+ if (tInvoiceWorkcontent.getBookingworkticket().getUserUnit() != null) {
|
|
for (SysDictData p : book_user_unit) {
|
|
for (SysDictData p : book_user_unit) {
|
|
if (tInvoiceWorkcontent.getBookingworkticket().getUserUnit().toString().equals(p.getDictValue())) {
|
|
if (tInvoiceWorkcontent.getBookingworkticket().getUserUnit().toString().equals(p.getDictValue())) {
|
|
contentUserUnit.append(p.getDictLabel());//用户单位
|
|
contentUserUnit.append(p.getDictLabel());//用户单位
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
- if(tInvoiceWorkcontent.getBookingworkticket().getUserMg()!=null){
|
|
|
|
- SysUser sysUser =sysUserService.selectUserById(tInvoiceWorkcontent.getBookingworkticket().getUserMg());
|
|
|
|
- contentUserUnit.append(sysUser.getNickName());
|
|
|
|
|
|
+ if (tInvoiceWorkcontent.getBookingworkticket().getUserMg() != null) {
|
|
|
|
+ SysUser sysUser = sysUserService.selectUserById(tInvoiceWorkcontent.getBookingworkticket().getUserMg());
|
|
|
|
+ contentUserUnit.append(sysUser.getNickName());
|
|
|
|
|
|
}
|
|
}
|
|
tJobticket.setByclxr(contentUserUnit.toString());
|
|
tJobticket.setByclxr(contentUserUnit.toString());
|
|
@@ -218,17 +211,17 @@ public class TJobticketController extends BaseController
|
|
tJobticket.setKprq(tInvoiceWorkcontent.getBookingworkticket().getWorkStartTime());
|
|
tJobticket.setKprq(tInvoiceWorkcontent.getBookingworkticket().getWorkStartTime());
|
|
//tJobticket.set
|
|
//tJobticket.set
|
|
//先查询是否重复
|
|
//先查询是否重复
|
|
- int same= tJobticketService.selectTJobticketSameData(tJobticket);
|
|
|
|
- if(same>0){
|
|
|
|
|
|
+ int same = tJobticketService.selectTJobticketSameData(tJobticket);
|
|
|
|
+ if (same > 0) {
|
|
sameCount++;
|
|
sameCount++;
|
|
- }else {
|
|
|
|
- nosanmeCount++;
|
|
|
|
|
|
+ } else {
|
|
tJobticketService.insertTJobticket(tJobticket);
|
|
tJobticketService.insertTJobticket(tJobticket);
|
|
|
|
+ nosanmeCount++;
|
|
}
|
|
}
|
|
|
|
|
|
contentUserUnit.delete(0, contentUserUnit.length());
|
|
contentUserUnit.delete(0, contentUserUnit.length());
|
|
}
|
|
}
|
|
- return AjaxResult.success("成功导入"+nosanmeCount+"条数据,"+"未导入重复"+sameCount+"条数据!");
|
|
|
|
|
|
+ return AjaxResult.success("成功导入" + nosanmeCount + "条数据," + "未导入重复" + sameCount + "条数据!");
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -237,13 +230,12 @@ public class TJobticketController extends BaseController
|
|
@PreAuthorize("@ss.hasPermi('ehs:jobticket:edit')")
|
|
@PreAuthorize("@ss.hasPermi('ehs:jobticket:edit')")
|
|
@Log(title = "工作票", businessType = BusinessType.UPDATE)
|
|
@Log(title = "工作票", businessType = BusinessType.UPDATE)
|
|
@PutMapping
|
|
@PutMapping
|
|
- public AjaxResult edit(@RequestBody TJobticket tJobticket)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult edit(@RequestBody TJobticket tJobticket) {
|
|
ISysUserService sysUserService = (ISysUserService) SpringContextUtils.getBean("sysUserService");
|
|
ISysUserService sysUserService = (ISysUserService) SpringContextUtils.getBean("sysUserService");
|
|
- StringBuilder contentUserUnit=new StringBuilder();
|
|
|
|
|
|
+ StringBuilder contentUserUnit = new StringBuilder();
|
|
List<SysDictData> book_user_unit = iSysDictTypeService.selectDictDataByType("book_user_unit");
|
|
List<SysDictData> book_user_unit = iSysDictTypeService.selectDictDataByType("book_user_unit");
|
|
|
|
|
|
- if(tJobticket.getUserUnit()!=null){
|
|
|
|
|
|
+ if (tJobticket.getUserUnit() != null) {
|
|
for (SysDictData p : book_user_unit) {
|
|
for (SysDictData p : book_user_unit) {
|
|
if (tJobticket.getUserUnit().toString().equals(p.getDictValue())) {
|
|
if (tJobticket.getUserUnit().toString().equals(p.getDictValue())) {
|
|
contentUserUnit.append(p.getDictLabel());//用户单位
|
|
contentUserUnit.append(p.getDictLabel());//用户单位
|
|
@@ -251,8 +243,8 @@ public class TJobticketController extends BaseController
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
- if(tJobticket.getUserMg()!=null){
|
|
|
|
- SysUser sysUser =sysUserService.selectUserById(tJobticket.getUserMg());
|
|
|
|
|
|
+ if (tJobticket.getUserMg() != null) {
|
|
|
|
+ SysUser sysUser = sysUserService.selectUserById(tJobticket.getUserMg());
|
|
contentUserUnit.append(sysUser.getNickName());
|
|
contentUserUnit.append(sysUser.getNickName());
|
|
}
|
|
}
|
|
tJobticket.setByclxr(contentUserUnit.toString());
|
|
tJobticket.setByclxr(contentUserUnit.toString());
|
|
@@ -266,9 +258,8 @@ public class TJobticketController extends BaseController
|
|
*/
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('ehs:jobticket:remove')")
|
|
@PreAuthorize("@ss.hasPermi('ehs:jobticket:remove')")
|
|
@Log(title = "工作票", businessType = BusinessType.DELETE)
|
|
@Log(title = "工作票", businessType = BusinessType.DELETE)
|
|
- @DeleteMapping("/{ids}")
|
|
|
|
- public AjaxResult remove(@PathVariable Long[] ids)
|
|
|
|
- {
|
|
|
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
|
+ public AjaxResult remove(@PathVariable Long[] ids) {
|
|
return toAjax(tJobticketService.deleteTJobticketByIds(ids));
|
|
return toAjax(tJobticketService.deleteTJobticketByIds(ids));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -278,12 +269,11 @@ public class TJobticketController extends BaseController
|
|
@PreAuthorize("@ss.hasPermi('ehs:jobticket:add')")
|
|
@PreAuthorize("@ss.hasPermi('ehs:jobticket:add')")
|
|
@Log(title = "工作票", businessType = BusinessType.INSERT)
|
|
@Log(title = "工作票", businessType = BusinessType.INSERT)
|
|
@PostMapping("/importData")
|
|
@PostMapping("/importData")
|
|
- public AjaxResult importData(@RequestParam("file") MultipartFile file) throws IOException
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult importData(@RequestParam("file") MultipartFile file) throws IOException {
|
|
//获取操作人员ID
|
|
//获取操作人员ID
|
|
Long userId = getUserId();
|
|
Long userId = getUserId();
|
|
//报错行数统计
|
|
//报错行数统计
|
|
- List<Integer> failRow =new ArrayList<Integer>();
|
|
|
|
|
|
+ List<Integer> failRow = new ArrayList<Integer>();
|
|
Workbook workbook = ExcelUtils.getWorkBook(file);
|
|
Workbook workbook = ExcelUtils.getWorkBook(file);
|
|
Sheet sheet = workbook.getSheetAt(0);
|
|
Sheet sheet = workbook.getSheetAt(0);
|
|
List<TJobticket> list = new ArrayList<TJobticket>();
|
|
List<TJobticket> list = new ArrayList<TJobticket>();
|
|
@@ -392,9 +382,9 @@ public class TJobticketController extends BaseController
|
|
entity.setCreaterCode(userId.toString());
|
|
entity.setCreaterCode(userId.toString());
|
|
logger.info("entity:" + entity);
|
|
logger.info("entity:" + entity);
|
|
list.add(entity);
|
|
list.add(entity);
|
|
- }catch (Exception e){
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
failNumber++;
|
|
failNumber++;
|
|
- failRow.add(i+1);
|
|
|
|
|
|
+ failRow.add(i + 1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
int successNumber = 0;
|
|
int successNumber = 0;
|
|
@@ -405,15 +395,15 @@ public class TJobticketController extends BaseController
|
|
try {
|
|
try {
|
|
tJobticketService.insertTJobticket(t);
|
|
tJobticketService.insertTJobticket(t);
|
|
successNumber++;
|
|
successNumber++;
|
|
- }catch (Exception e){
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
failNumber++;
|
|
failNumber++;
|
|
- failRow.add(failNum+1);
|
|
|
|
|
|
+ failRow.add(failNum + 1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
logger.info("list:" + JSON.toJSONString(list));
|
|
logger.info("list:" + JSON.toJSONString(list));
|
|
- logger.info("successNumber:" +String.valueOf(successNumber));
|
|
|
|
- logger.info("failNumber:" +String.valueOf(failNumber));
|
|
|
|
- logger.info("failRow:" +String.valueOf(failRow));
|
|
|
|
|
|
+ logger.info("successNumber:" + String.valueOf(successNumber));
|
|
|
|
+ logger.info("failNumber:" + String.valueOf(failNumber));
|
|
|
|
+ logger.info("failRow:" + String.valueOf(failRow));
|
|
return AjaxResult.success(String.valueOf(successNumber), failRow);
|
|
return AjaxResult.success(String.valueOf(successNumber), failRow);
|
|
}
|
|
}
|
|
}
|
|
}
|